[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Tue, 3 Mar 2015 08:25:05 +0000
From: Sheng Yong <shengyong1@...wei.com>
To: <mmarek@...e.cz>, <sam@...nborg.org>
CC: <linux-kernel@...r.kernel.org>
Subject: [RFC PATCH] genksyms: fix segmentation fault when parsing redefinition of typedef
Check if name is NULL to avoid segmentation fault when generate crc32
value. Otherwise, it is not easy to find out what is wrong in the code.
If name is NULL, just return it and continue, then gcc could find out
the incorrect position.
Signed-off-by: Sheng Yong <shengyong1@...wei.com>
---
scripts/genksyms/genksyms.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/scripts/genksyms/genksyms.c b/scripts/genksyms/genksyms.c
index 88632df..ba6cfa9 100644
--- a/scripts/genksyms/genksyms.c
+++ b/scripts/genksyms/genksyms.c
@@ -233,11 +233,11 @@ static struct symbol *__add_symbol(const char *name, enum symbol_type type,
free_list(last_enum_expr, NULL);
last_enum_expr = NULL;
enum_counter = 0;
- if (!name)
- /* Anonymous enum definition, nothing more to do */
- return NULL;
}
+ if (!name)
+ return NULL;
+
h = crc32(name) % HASH_BUCKETS;
for (sym = symtab[h]; sym; sym = sym->hash_next) {
if (map_to_ns(sym->type) == map_to_ns(type) &&
--
1.8.3.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists