Ver código fonte

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>
Ian Molton 15 anos atrás
pai
commit
eed89d0f9d
1 arquivos alterados com 2 adições e 1 exclusões
  1. 2 1
      drivers/char/hw_random/core.c

+ 2 - 1
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)
 {