Skip to contentSkip to conversation

proc_misc.c comments

DISCUSSION tom st denis 2 participants 2 messages Jun 23, 2004

lore
Share & tools
lore
#0 lore raw

I was toying around with the idea of making /proc/meminfo use KiB as the unit instead of KB [just something to waste 10 mins] when I noticed that you guys have prototypes like

static int meminfo_read_proc(char *page, char **start, off_t off,
int count, int *eof, void *data)

Then do things like

len = sprintf(page,

Wouldn't it be safer to pass the size of "page" into the function and use snprintf to prevent any possible buffer overflows?

Sure right now it's not a problem but it would make the code easier to review, say when someone wants to add a /proc/thingymagingy later on in the future.

I'm still a kernel newbie so I'll defer the coding work to other people ;-) Just thought I would point that out.

Tom

__________________________________
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.
http://promotions.yahoo.com/new_mail

#1 lore raw
Quoted 3 lines · tom st denis

I was toying around with the idea of making /proc/meminfo use KiB as the unit instead of KB

Not an option. The layout of files in /proc/ is effectively a user interface. Any change can break any program.

Jörn

Signature · 2 lines
Those who come seeking peace without a treaty are plotting.
-- Sun Tzu