Commit adf781b0 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] Reduced stack usage in random.c

Patch from: Matthew Wilcox <willy@debian.org>

Reduces stack use in random.c by 350 (or maybe 700) bytes by sharing a local
array between two functions.
parent f208cebd
......@@ -1228,10 +1228,8 @@ static ssize_t extract_entropy(struct entropy_store *r, void * buf,
* at which point we do a "catastrophic reseeding".
*/
static inline void xfer_secondary_pool(struct entropy_store *r,
size_t nbytes)
size_t nbytes, __u32 *tmp)
{
__u32 tmp[TMP_BUF_SIZE];
if (r->entropy_count < nbytes * 8 &&
r->entropy_count < r->poolinfo.POOLBITS) {
int nwords = min_t(int,
......@@ -1284,7 +1282,7 @@ static ssize_t extract_entropy(struct entropy_store *r, void * buf,
r->entropy_count = r->poolinfo.POOLBITS;
if (flags & EXTRACT_ENTROPY_SECONDARY)
xfer_secondary_pool(r, nbytes);
xfer_secondary_pool(r, nbytes, tmp);
DEBUG_ENT("%s has %d bits, want %d bits\n",
r == sec_random_state ? "secondary" :
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment