Commit d93cf734 authored by Michal Marek's avatar Michal Marek Committed by Greg Kroah-Hartman

genksyms: Fix segfault with invalid declarations

commit d920f7c6 upstream.

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: default avatarBorislav Petkov <bp@alien8.de>
Signed-off-by: default avatarMichal Marek <mmarek@suse.com>
[arnd: rebase to 4.4, regenerate parse.tab.{c,h}]
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 5381db24
This diff is collapsed.
/* A Bison parser, made by GNU Bison 2.7. */
/* A Bison parser, made by GNU Bison 3.0.4. */
/* Bison interface for Yacc-like parsers in C
Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc.
Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
......@@ -26,93 +26,80 @@
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
#ifndef YY_YY_SCRIPTS_GENKSYMS_PARSE_TAB_H_SHIPPED_INCLUDED
# define YY_YY_SCRIPTS_GENKSYMS_PARSE_TAB_H_SHIPPED_INCLUDED
/* Enabling traces. */
#ifndef YY_YY_PARSE_TAB_H_INCLUDED
# define YY_YY_PARSE_TAB_H_INCLUDED
/* Debug traces. */
#ifndef YYDEBUG
# define YYDEBUG 1
# define YYDEBUG 0
#endif
#if YYDEBUG
extern int yydebug;
#endif
/* Tokens. */
/* Token type. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
/* Put the tokens into the symbol table, so that GDB and other debuggers
know about them. */
enum yytokentype {
ASM_KEYW = 258,
ATTRIBUTE_KEYW = 259,
AUTO_KEYW = 260,
BOOL_KEYW = 261,
CHAR_KEYW = 262,
CONST_KEYW = 263,
DOUBLE_KEYW = 264,
ENUM_KEYW = 265,
EXTERN_KEYW = 266,
EXTENSION_KEYW = 267,
FLOAT_KEYW = 268,
INLINE_KEYW = 269,
INT_KEYW = 270,
LONG_KEYW = 271,
REGISTER_KEYW = 272,
RESTRICT_KEYW = 273,
SHORT_KEYW = 274,
SIGNED_KEYW = 275,
STATIC_KEYW = 276,
STRUCT_KEYW = 277,
TYPEDEF_KEYW = 278,
UNION_KEYW = 279,
UNSIGNED_KEYW = 280,
VOID_KEYW = 281,
VOLATILE_KEYW = 282,
TYPEOF_KEYW = 283,
EXPORT_SYMBOL_KEYW = 284,
ASM_PHRASE = 285,
ATTRIBUTE_PHRASE = 286,
TYPEOF_PHRASE = 287,
BRACE_PHRASE = 288,
BRACKET_PHRASE = 289,
EXPRESSION_PHRASE = 290,
CHAR = 291,
DOTS = 292,
IDENT = 293,
INT = 294,
REAL = 295,
STRING = 296,
TYPE = 297,
OTHER = 298,
FILENAME = 299
};
enum yytokentype
{
ASM_KEYW = 258,
ATTRIBUTE_KEYW = 259,
AUTO_KEYW = 260,
BOOL_KEYW = 261,
CHAR_KEYW = 262,
CONST_KEYW = 263,
DOUBLE_KEYW = 264,
ENUM_KEYW = 265,
EXTERN_KEYW = 266,
EXTENSION_KEYW = 267,
FLOAT_KEYW = 268,
INLINE_KEYW = 269,
INT_KEYW = 270,
LONG_KEYW = 271,
REGISTER_KEYW = 272,
RESTRICT_KEYW = 273,
SHORT_KEYW = 274,
SIGNED_KEYW = 275,
STATIC_KEYW = 276,
STRUCT_KEYW = 277,
TYPEDEF_KEYW = 278,
UNION_KEYW = 279,
UNSIGNED_KEYW = 280,
VOID_KEYW = 281,
VOLATILE_KEYW = 282,
TYPEOF_KEYW = 283,
EXPORT_SYMBOL_KEYW = 284,
ASM_PHRASE = 285,
ATTRIBUTE_PHRASE = 286,
TYPEOF_PHRASE = 287,
BRACE_PHRASE = 288,
BRACKET_PHRASE = 289,
EXPRESSION_PHRASE = 290,
CHAR = 291,
DOTS = 292,
IDENT = 293,
INT = 294,
REAL = 295,
STRING = 296,
TYPE = 297,
OTHER = 298,
FILENAME = 299
};
#endif
/* Value type. */
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef int YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
#endif
extern YYSTYPE yylval;
#ifdef YYPARSE_PARAM
#if defined __STDC__ || defined __cplusplus
int yyparse (void *YYPARSE_PARAM);
#else
int yyparse ();
#endif
#else /* ! YYPARSE_PARAM */
#if defined __STDC__ || defined __cplusplus
int yyparse (void);
#else
int yyparse ();
#endif
#endif /* ! YYPARSE_PARAM */
#endif /* !YY_YY_SCRIPTS_GENKSYMS_PARSE_TAB_H_SHIPPED_INCLUDED */
#endif /* !YY_YY_PARSE_TAB_H_INCLUDED */
......@@ -320,8 +320,6 @@ direct_declarator:
{ $$ = $2; }
| '(' declarator ')'
{ $$ = $3; }
| '(' error ')'
{ $$ = $3; }
;
/* Nested declarators differ from regular declarators in that they do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment