From eed89d0f9d3383851cec634565a6414fae70fe91 Mon Sep 17 00:00:00 2001 From: Ian Molton Date: Thu, 3 Dec 2009 13:50:42 +0800 Subject: [PATCH] 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 Signed-off-by: Herbert Xu --- drivers/char/hw_random/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c index 5c2d13c6e189..8b7d56a0fe3a 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) { -- 2.20.1