Re: [patch 9/9] Add bcm43xx HW RNG support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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); ?

> +	bcm43xx_unlock(bcm, flags);
> +
> +	return (sizeof(u16));
> +}

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

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux