lkml.org 
[lkml]   [2010]   [Mar]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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


\
 
 \ /
  Last update: 2010-03-15 16:37    [W:0.044 / U:18.764 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site