mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* proc_misc.c comments
@ 2004-06-23 13:33 tom st denis
  2004-06-23 14:01 ` Jörn Engel
  0 siblings, 1 reply; 2+ messages in thread
From: tom st denis @ 2004-06-23 13:33 UTC (permalink / raw)
  To: linux-kernel

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 

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

* Re: proc_misc.c comments
  2004-06-23 13:33 proc_misc.c comments tom st denis
@ 2004-06-23 14:01 ` Jörn Engel
  0 siblings, 0 replies; 2+ messages in thread
From: Jörn Engel @ 2004-06-23 14:01 UTC (permalink / raw)
  To: tom st denis; +Cc: linux-kernel

On Wed, 23 June 2004 06:33:09 -0700, tom st denis wrote:
> 
> 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

-- 
Those who come seeking peace without a treaty are plotting.
-- Sun Tzu

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

end of thread, other threads:[~2004-06-23 14:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-06-23 13:33 proc_misc.c comments tom st denis
2004-06-23 14:01 ` Jörn Engel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®