hwrng: core - Prevent too-small buffer sizes
authorIan Molton <ian.molton@collabora.co.uk>
Thu, 3 Dec 2009 05:50:42 +0000 (13:50 +0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Thu, 3 Dec 2009 05:50:42 +0000 (13:50 +0800)
This patch prevents the hw_random core using too small of a buffer
on machines with small cacheline sizes.

Signed-off-by: Ian Molton <ian.molton@collabora.co.uk>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/char/hw_random/core.c

index 5c2d13c6e1890809ed8ed6ea5d3da9737b169c22..8b7d56a0fe3a50f3620709a8b0c14ec703409305 100644 (file)
@@ -53,7 +53,8 @@ static struct hwrng *current_rng;
 static LIST_HEAD(rng_list);
 static DEFINE_MUTEX(rng_mutex);
 static int data_avail;
-static u8 rng_buffer[SMP_CACHE_BYTES] __cacheline_aligned;
+static u8 rng_buffer[SMP_CACHE_BYTES < 32 ? 32 : SMP_CACHE_BYTES]
+       __cacheline_aligned;
 
 static inline int hwrng_init(struct hwrng *rng)
 {