lkml.org 
[lkml]   [2012]   [Oct]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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


\
 
 \ /
  Last update: 2012-10-18 12:21    [W:2.588 / U:0.576 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site