[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20080629095424.GM20815@postel.suug.ch>
Date: Sun, 29 Jun 2008 11:54:24 +0200
From: Thomas Graf <tgraf@...g.ch>
To: David Miller <davem@...emloft.net>
Cc: harvey.harrison@...il.com, netdev@...r.kernel.org
Subject: Re: [PATCH] net: em_cmp.c use unaligned access helpers
* David Miller <davem@...emloft.net> 2008-06-27 20:16
> From: Harvey Harrison <harvey.harrison@...il.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@...il.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.
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.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists