Skip to content

Commit

Permalink
hwrng: core - Prevent too-small buffer sizes
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Ian Molton authored and Herbert Xu committed Dec 3, 2009
1 parent bb347d9 commit eed89d0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/char/hw_random/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down

0 comments on commit eed89d0

Please sign in to comment.