Re: [PATCH] net: clean up some sparse endianness warnings in ipv6.h
From: Jeff Layton
Date: Tue Jul 15 2014 - 13:17:31 EST
On Tue, 15 Jul 2014 10:01:07 -0700
Christoph Hellwig <hch@xxxxxxxxxxxxx> wrote:
> > #if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64
> > - const unsigned long *ul = (const unsigned long *)a;
> > + const __be64 *be = (const __be64 *)a;
> >
> > - return (ul[0] | (ul[1] ^ cpu_to_be64(1))) == 0UL;
> > + return (be[0] | (be[1] ^ cpu_to_be64(1))) == cpu_to_be64(0UL);
>
> Do you need the swap for 0UL? I know sparse treats 0 as special, so why
> wouldn't it treat 0UL special? Or just remove the 0UL postfix, no need
> for it in a simple comparism.
>
> Otherwise looks fine to me.
Maybe not, I did it for completeness sake. I'll see if I can remove
that. The macros do the conversion at compile time though so it
shouldn't hurt anything either way.
--
Jeff Layton <jlayton@xxxxxxxxxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/