[PATCH] sbp2: fix spinlock recursion
[safe/jmp/linux-2.6] / scripts / kallsyms.c
index 1f53d4f..22d281c 100644 (file)
@@ -116,11 +116,19 @@ static int read_symbol(FILE *in, struct sym_entry *s)
        else if (toupper(stype) == 'U' ||
                 is_arm_mapping_symbol(sym))
                return -1;
+       /* exclude also MIPS ELF local symbols ($L123 instead of .L123) */
+       else if (str[0] == '$')
+               return -1;
 
        /* include the type field in the symbol name, so that it gets
         * compressed together */
        s->len = strlen(str) + 1;
        s->sym = malloc(s->len + 1);
+       if (!s->sym) {
+               fprintf(stderr, "kallsyms failure: "
+                       "unable to allocate required amount of memory\n");
+               exit(EXIT_FAILURE);
+       }
        strcpy((char *)s->sym + 1, str);
        s->sym[0] = stype;
 
@@ -269,7 +277,12 @@ static void write_src(void)
 
        /* table of offset markers, that give the offset in the compressed stream
         * every 256 symbols */
-       markers = (unsigned int *) malloc(sizeof(unsigned int) * ((table_cnt + 255) / 256));
+       markers = malloc(sizeof(unsigned int) * ((table_cnt + 255) / 256));
+       if (!markers) {
+               fprintf(stderr, "kallsyms failure: "
+                       "unable to allocate required memory\n");
+               exit(EXIT_FAILURE);
+       }
 
        output_label("kallsyms_names");
        off = 0;