lkml.org 
[lkml]   [2006]   [May]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [patch 9/9] Add bcm43xx HW RNG support
Date
On Friday 12 May 2006 17:16, Denis Vlasenko wrote:
> On Friday 12 May 2006 13:35, Michael Buesch wrote:
> > +static int bcm43xx_rng_read(struct hwrng *rng, u32 *data)
> > +{
> > + struct bcm43xx_private *bcm = (struct bcm43xx_private *)rng->priv;
> > + unsigned long flags;
> > +
> > + bcm43xx_lock(bcm, flags);
> > + *data = bcm43xx_read16(bcm, BCM43xx_MMIO_RNG);
>
> You are storing random 16-bit value _and_ 16 zero bits
> into 32-bit memory location. Probably not a problem for
> little-endian machine (you return 2, indicating that there
> are only 2 bytes of randomness), but on big endian?
>
> Didn't you mean
>
> *(u16*)data = bcm43xx_read16(bcm, BCM43xx_MMIO_RNG); ?


Nope, the code is correct.

--
Greetings Michael.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-05-12 22:46    [W:0.069 / U:0.212 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site