]> git.hungrycats.org Git - linux/commitdiff
[PATCH] Reduced stack usage in random.c
authorAndrew Morton <akpm@digeo.com>
Thu, 6 Mar 2003 09:13:58 +0000 (01:13 -0800)
committerLinus Torvalds <torvalds@home.transmeta.com>
Thu, 6 Mar 2003 09:13:58 +0000 (01:13 -0800)
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.

drivers/char/random.c

index ab129078ec945842b3ada5ccff702594b15c9a07..6cd307819049e82a7ef5a2f692dc42c1fb9c3d86 100644 (file)
@@ -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" :