From: Anatoly Pugachev <matorola@gmail.com>
To: Florian Westphal <fw@strlen.de>
Cc: netfilter-devel@vger.kernel.org, coreteam@netfilter.org,
debian-sparc <debian-sparc@lists.debian.org>
Subject: Re: [sparc64] nft bus error
Date: Sat, 13 Jul 2019 22:26:02 +0300 [thread overview]
Message-ID: <CADxRZqw+MrtQhQF1_AZ2Gr_Sm5xmWjH0ZwjKXKdZ_rQqOvSrhw@mail.gmail.com> (raw)
In-Reply-To: <20190713190320.pmu33mx2lm75fihd@breakpoint.cc>
On Sat, Jul 13, 2019 at 10:03 PM Florian Westphal <fw@strlen.de> wrote:
> Anatoly Pugachev <matorola@gmail.com> 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
prev parent reply other threads:[~2019-07-13 19:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-13 18:45 [sparc64] nft bus error Anatoly Pugachev
[not found] ` <20190713190320.pmu33mx2lm75fihd@breakpoint.cc>
2019-07-13 19:26 ` Anatoly Pugachev [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CADxRZqw+MrtQhQF1_AZ2Gr_Sm5xmWjH0ZwjKXKdZ_rQqOvSrhw@mail.gmail.com \
--to=matorola@gmail.com \
--cc=coreteam@netfilter.org \
--cc=debian-sparc@lists.debian.org \
--cc=fw@strlen.de \
--cc=netfilter-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).