Re: [PATCH] fix sys cpumap for > 352 NR_CPUS

From: Paul Jackson
Date: Wed Jun 02 2004 - 23:19:43 EST


Rusty wrote:
> Then just use -1UL as the arg to scnprintf, if you don't have a real
> number. That way the overflow will at least have a chance of detection
> in the sysfs code, which I think it should check in
> file.c:fill_read_buffer(). Greg?

That doesn't make sense.

My node_read_cpumap() routine is being passed a finite length buffer
into which it is supposed to put some characters. Unless by contract
or passed value it knows the length of that buffer, it cannot safely
know how far it can write.

Apparently, from Andrews comments and from the line:

buffer->page = (char *) get_zeroed_page(GFP_KERNEL);

in file.c:fill_read_buffer(), the length is PAGE_SIZE, by contract.

Greg - perhaps a comment in include/linux/sysdev.h, near the declarations
for the show() and store() routines, specifying the buffer sizing,
would be appropriate?

--
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <pj@xxxxxxx> 1.650.933.1373
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/