Messages in this thread | | | Date | Mon, 15 Mar 2010 15:01:43 +0000 | From | Paulo Marques <> | Subject | Re: [PATCH] vsprintf.c: remove stack variable ksym from |
| |
Joe Perches wrote: > On Sat, 2010-03-13 at 09:44 -0800, Joe Perches wrote: >> On Sat, 2010-03-13 at 07:35 -0800, Linus Torvalds wrote: >>> On Fri, 12 Mar 2010, Andrew Morton wrote: >>>> nice. >>> But the kallsyms_lookup()/sprint_symbol() functions don't take a >>> length parameter, so we have to do the worst-case thing (which itself has >>> tons of unnecessary padding). >> Perhaps a new snprint_symbol function with the >> other kallsyms... functions changed as necessary. > > Perhaps something like this:
Just one minor nit:
[...] > > - *result = '\0'; > + if (size) > + *result = '\0';
This test seems to be here to handle the "size == 0" case, but
>[...] > +const char *kallsyms_lookup_n(unsigned long addr, > + unsigned long *symbolsize, > + unsigned long *offset, > + char **modname, char *namebuf, size_t size) > +{ > + if (size) > + namebuf[size - 1] = 0; > + namebuf[0] = 0;
here we seem to write the namebuf[0] even if "size == 0". So maybe both assignments in this function should be inside the "if (size)" test.
Other than that, the patch looks good:
Reviewed-by: Paulo Marques <pmarques@grupopie.com>
-- Paulo Marques - www.grupopie.com
"As far as we know, our computer has never had an undetected error." Weisert
| |