[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <49AAE94E.8080308@suse.de>
Date: Sun, 01 Mar 2009 21:00:14 +0100
From: Frank Seidel <fseidel@...e.de>
To: linux kernel <linux-kernel@...r.kernel.org>
Cc: akpm@...ux-foundation.org, Ankita Garg <ankita@...ibm.com>,
Adrian Bunk <bunk@...nel.org>,
Randy Dunlap <randy.dunlap@...cle.com>,
Frank Seidel <fseidel@...e.de>,
Frank Seidel <frank@...eidel.de>, kernalert.de@...il.com
Subject: [PATCH] lkdtm: reduce stack size
From: Frank Seidel <frank@...eidel.de>
Reduce stack memory footprint of lkdtm
(recursive_loop). From 1024 bytes on i386 down
to <10.
Signed-off-by: Frank Seidel <frank@...eidel.de>
---
drivers/misc/lkdtm.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
--- a/drivers/misc/lkdtm.c
+++ b/drivers/misc/lkdtm.c
@@ -225,14 +225,24 @@ static int lkdtm_parse_commandline(void)
static int recursive_loop(int a)
{
- char buf[1024];
+ char *buf;
+ int ret;
+
+ buf = kmalloc(1024, GFP_KERNEL);
+ if (!buf) {
+ printk(KERN_ERR "lkdtm : couldn't allocate buffer\n");
+ return -ENOMEM;
+ }
memset(buf,0xFF,1024);
recur_count--;
if (!recur_count)
- return 0;
+ ret = 0;
else
- return recursive_loop(a);
+ ret = recursive_loop(a);
+
+ kfree(buf);
+ return ret;
}
void lkdtm_handler(void)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists