
From: David Mosberger <davidm@napali.hpl.hp.com>

interrupts_open() can easily try to kmalloc() more memory than
supported by kmalloc.  E.g., with 16KB page size and NR_CPUS==64, it
would try to allocate 147456 bytes.

The workaround below is to allocate 4KB per 8 CPUs.  Not really a
solution, but the fundamental problem is that /proc/interrupts
shouldn't use a fixed buffer size in the first place.  I suppose
another solution would be to use vmalloc() instead.  It all feels like
bandaids though.



 fs/proc/proc_misc.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

diff -puN fs/proc/proc_misc.c~proc-interrupts-kmalloc-size fs/proc/proc_misc.c
--- 25/fs/proc/proc_misc.c~proc-interrupts-kmalloc-size	2003-04-12 16:21:14.000000000 -0700
+++ 25-akpm/fs/proc/proc_misc.c	2003-04-12 16:22:35.000000000 -0700
@@ -386,7 +386,7 @@ static int devices_read_proc(char *page,
 extern int show_interrupts(struct seq_file *p, void *v);
 static int interrupts_open(struct inode *inode, struct file *file)
 {
-	unsigned size = PAGE_SIZE * (1 + NR_CPUS / 8);
+	unsigned size = 4096 * (1 + num_online_cpus() / 8);
 	char *buf = kmalloc(size, GFP_KERNEL);
 	struct seq_file *m;
 	int res;

_
