Re: [sparc64] nft bus error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Jul 13, 2019 at 10:03 PM Florian Westphal <fw@xxxxxxxxx> wrote:
> Anatoly Pugachev <matorola@xxxxxxxxx> wrote:
> > Program received signal SIGBUS, Bus error.
> > 0xfff8000100946490 in nftnl_udata_get_u32 (attr=0x10000106e30) at udata.c:127
> > 127             return *data;
>
> struct nftnl_udata {
>        uint8_t         type;
>        uint8_t         len;
>        unsigned char   value[];
> } __attribute__((__packed__));
>
> Sparc doesn't like doing:
>
> uint32_t nftnl_udata_get_u32(const struct nftnl_udata *attr)
> {
>         uint32_t *data = (uint32_t *)attr->value;
>
>         return *data;
> }
>
> Anatoly, does this help?
>
> diff --git a/src/udata.c b/src/udata.c
> --- a/src/udata.c
> +++ b/src/udata.c
> @@ -122,9 +122,11 @@ void *nftnl_udata_get(const struct nftnl_udata *attr)
>  EXPORT_SYMBOL(nftnl_udata_get_u32);
>  uint32_t nftnl_udata_get_u32(const struct nftnl_udata *attr)
>  {
> -       uint32_t *data = (uint32_t *)attr->value;
> +       uint32_t data;
>
> -       return *data;
> +       memcpy(&data, attr->value, sizeof(data));
> +
> +       return data;
>  }
>
>  EXPORT_SYMBOL(nftnl_udata_next);

Florian,

yes, works beautifully!

Thanks!

PS: missed CC list



[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux