summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIan Molton <ian.molton@collabora.co.uk>2009-12-03 13:50:42 +0800
committerHerbert Xu <herbert@gondor.apana.org.au>2009-12-03 13:50:42 +0800
commiteed89d0f9d3383851cec634565a6414fae70fe91 (patch)
treeec1bd56b152d2b5a53a20aa7fde21a60ce794c9c
parentbb347d98079a547e80bd4722dee1de61e4dca0e8 (diff)
downloadop-kernel-dev-eed89d0f9d3383851cec634565a6414fae70fe91.zip
op-kernel-dev-eed89d0f9d3383851cec634565a6414fae70fe91.tar.gz
hwrng: core - Prevent too-small buffer sizes
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>
-rw-r--r--drivers/char/hw_random/core.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c
index 5c2d13c..8b7d56a 100644
--- a/drivers/char/hw_random/core.c
+++ b/drivers/char/hw_random/core.c
@@ -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)
{
OpenPOWER on IntegriCloud