From: Harvey Harrison <harvey.harrison@gmail.com>
To: Thomas Graf <tgraf@suug.ch>
Cc: David Miller <davem@davemloft.net>, netdev@vger.kernel.org
Subject: Re: [PATCH] net: em_cmp.c use unaligned access helpers
Date: Sun, 29 Jun 2008 11:01:30 -0700 [thread overview]
Message-ID: <1214762490.6037.9.camel@brick> (raw)
In-Reply-To: <20080629095424.GM20815@postel.suug.ch>
On Sun, 2008-06-29 at 11:54 +0200, Thomas Graf wrote:
> * David Miller <davem@davemloft.net> 2008-06-27 20:16
> > From: Harvey Harrison <harvey.harrison@gmail.com>
> > Date: Wed, 25 Jun 2008 14:14:00 -0700
> >
> > > Both locations are loading a big-endian value in cpu-endianness. The
> > > be32/be16_to_cpu immediately afterwards seems suspect.
> > >
> > > Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
> >
> > Smells like a bug, Thomas can you take a close look at this?
>
> It's not a bug, the u16|u32 pointed to by ptr can be at any offset in the
> skb buffer and is not necessarly in big endian, it can be both. Only the
> user knows so he has to specify a flag if the value should be converted
> from be to cpu.
OK, but be16/32_to_cpu is a no-op on be-arches, so there is a bug here on
big-endian machines as they won't switch it back, your simplified patch
is actually a bugfix in that case.
>
> I think the code is correct, although it could be simplified to:
>
> case TCF_EM_ALIGN_U16:
> if (!cmp_needs_transformation(cmp))
> val = get_unaligned_le16(ptr);
> else
> val = get_unaligned_be16(ptr);
>
> I wasn't aware of these flags when I wrote the code initially.
I introduced them recently, your patch is probably applicable to
2.6.26 as a bugfix.
Reviewed-by: Harvey Harrison <harvey.harrison@gmail.com>
next prev parent reply other threads:[~2008-06-29 18:01 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-25 21:14 [PATCH] net: em_cmp.c use unaligned access helpers Harvey Harrison
2008-06-28 3:16 ` David Miller
2008-06-29 9:54 ` Thomas Graf
2008-06-29 9:55 ` Thomas Graf
2008-06-29 23:20 ` Harvey Harrison
2008-06-29 18:01 ` Harvey Harrison [this message]
2008-06-29 23:26 ` Thomas Graf
2008-07-05 2:10 ` Harvey Harrison
2008-07-10 11:13 ` Thomas Graf
-- strict thread matches above, loose matches on Subject: below --
2008-09-18 0:00 Harvey Harrison
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=1214762490.6037.9.camel@brick \
--to=harvey.harrison@gmail.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=tgraf@suug.ch \
/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).