fix possible null ptr deref in kallsyms_lookup
authorKyle McMartin <kyle@parisc-linux.org>
Wed, 30 May 2007 06:43:16 +0000 (02:43 -0400)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Wed, 30 May 2007 17:51:38 +0000 (10:51 -0700)
ugh, this function gets called by our unwinder. recursive backtrace for
the win... bisection to find this one was "fun."

Signed-off-by: Kyle McMartin <kyle@parisc-linux.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
kernel/kallsyms.c

index f1bda23140b2a60d0be17fade305d3ec3afae431..fed54418626c10727662a79d0e505ee302e0bcbf 100644 (file)
@@ -257,7 +257,8 @@ const char *kallsyms_lookup(unsigned long addr,
                pos = get_symbol_pos(addr, symbolsize, offset);
                /* Grab name */
                kallsyms_expand_symbol(get_symbol_offset(pos), namebuf);
                pos = get_symbol_pos(addr, symbolsize, offset);
                /* Grab name */
                kallsyms_expand_symbol(get_symbol_offset(pos), namebuf);
-               *modname = NULL;
+               if (modname)
+                       *modname = NULL;
                return namebuf;
        }
 
                return namebuf;
        }