[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20121018105956.2f3ea239@pyramind.ukuu.org.uk>
Date: Thu, 18 Oct 2012 10:59:56 +0100
From: Alan Cox <alan@...rguk.ukuu.org.uk>
To: Jeffrey Ladouceur <jladouceur@...il.com>
Cc: Mark Einon <mark.einon@...il.com>, devel@...verdev.osuosl.org,
gregkh@...uxfoundation.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] staging: et131x: Fix 64bit tx dma address handling
> > + skb_headlen(skb),
> > + DMA_TO_DEVICE);
> > + desc[frag].addr_lo = dma_addr & 0xFFFFFFFF;
> > + desc[frag].addr_hi = dma_addr >> 32;
>
> Maybe use macros defined in kernel.h instead:
>
> desc[frag].addr_lo = lower_32_bits(dma_addr);
> desc[frag].addr_hi = upper_32_bits(dma_addr);
>
> A few more instances below.
This is actually important because >> 32 of a 32bit value is undefined in
C. The compiler is free to do what it likes with this. While the results
are usually sane some architectures do generate the equivalent of
x >> (n % wordsize);
Alan
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists