genksyms: Fix segfault with invalid declarations
authorMichal Marek <mmarek@suse.com>
Tue, 3 Jan 2017 13:40:44 +0000 (14:40 +0100)
committerMichal Marek <mmarek@suse.com>
Thu, 5 Jan 2017 12:00:54 +0000 (13:00 +0100)
Do not try to recover too early and segfault when parsing invalid
declarations such as

echo 'int (int);' | scripts/genksyms/genksyms
echo 'int a, (int);' | scripts/genksyms/genksyms
echo 'extern void *__inline_memcpy((void *), (const void *), (__kernel_size_t));' | scripts/genksyms/genksyms

The last one was a real-life bug with
include/asm-generic/asm-prototypes.h on x86_64.

Reported-and-tested-by: Borislav Petkov <bp@alien8.de>
Signed-off-by: Michal Marek <mmarek@suse.com>
scripts/genksyms/parse.y

index 4fba255e54ae49ed0fcf196b4e72695624eab58b..00a6d7e5497126147dc0d9a564c4a6525fff6079 100644 (file)
@@ -322,8 +322,6 @@ direct_declarator:
                { $$ = $2; }
        | '(' declarator ')'
                { $$ = $3; }
-       | '(' error ')'
-               { $$ = $3; }
        ;
 
 /* Nested declarators differ from regular declarators in that they do