linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* proc_misc.c bug
@ 2003-04-10 22:02 David Mosberger
  2003-04-10 21:44 ` Alan Cox
  2003-04-10 22:18 ` Andrew Morton
  0 siblings, 2 replies; 12+ messages in thread
From: David Mosberger @ 2003-04-10 22:02 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel

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.

	--david

===== fs/proc/proc_misc.c 1.71 vs edited =====
--- 1.71/fs/proc/proc_misc.c	Sat Mar 22 22:14:49 2003
+++ edited/fs/proc/proc_misc.c	Thu Apr 10 14:35:16 2003
@@ -388,7 +388,7 @@
 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 + NR_CPUS / 8);
 	char *buf = kmalloc(size, GFP_KERNEL);
 	struct seq_file *m;
 	int res;

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2003-04-11 18:21 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-10 22:02 proc_misc.c bug David Mosberger
2003-04-10 21:44 ` Alan Cox
2003-04-10 22:49   ` Randy.Dunlap
2003-04-11  5:01     ` Randy.Dunlap
2003-04-11  5:28       ` Andrew Morton
2003-04-11  5:41       ` David Mosberger
2003-04-11  5:46         ` Zwane Mwaikambo
2003-04-11 17:29         ` Randy.Dunlap
2003-04-11 18:32           ` David Mosberger
2003-04-10 22:53   ` Andrew Morton
2003-04-11  0:27   ` David Mosberger
2003-04-10 22:18 ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).