• Mika Kukkonen's avatar
    [PATCH] sparse: define max kernel symbol length and clean up errors in kernel/kallsyms.c · 77e5ab66
    Mika Kukkonen authored
      CHECK   kernel/kallsyms.c
    kernel/kallsyms.c:136:7: warning: bad constant expression
    kernel/kallsyms.c:136:7: warning: bad constant expression
    kernel/kallsyms.c:136:7: warning: bad constant expression
    kernel/kallsyms.c:143:22: warning: bad constant expression
    kernel/kallsyms.c:143:22: warning: bad constant expression
    kernel/kallsyms.c:143:22: warning: bad constant expression
    
    Now the cause of sparse warnings is that it does not handle runtime array
    dimensioning (which I take it is a sparse problem), but in this particular
    case it _might_ make sense to change the runtime allocation to compile
    time, as the upper size of the array is known, because the code in
    kernel/kallsyms.c clearly uses 127 (or 128) as "magic constant" for kernel
    symbol (array) length, and in the other hand in include/linux/module.h
    there is: #define MODULE_NAME_LEN (64 - sizeof(unsigned long))
    
    The only concern is that the array become quite big (the original comment
    of it being "pretty small" no longer applies ...).  One way to help that
    would be to use buffer[] also in place of namebuf[], but that would be
    little tricky as the format string should be before the symbol name ... 
    Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
    77e5ab66
kallsyms.c 7.55 KB