summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMasahiro Yamada <masahiroy@kernel.org>2025-01-14 00:00:51 +0900
committerMasahiro Yamada <masahiroy@kernel.org>2025-01-18 09:11:47 +0900
commit2ac068cb0b366c61e7aebaccf0240eae8b2c1b43 (patch)
tree3accbc6e1d1fb59d2c381b1ade7b095ea241178c
parenta8b7d066f8626ec847d3e66aef1320968d1fe298 (diff)
downloadlinux-2ac068cb0b366c61e7aebaccf0240eae8b2c1b43.tar.gz
linux-2ac068cb0b366c61e7aebaccf0240eae8b2c1b43.tar.bz2
linux-2ac068cb0b366c61e7aebaccf0240eae8b2c1b43.zip
genksyms: fix syntax error for attribute after abstact_declarator
A longstanding issue with genksyms is that it has hidden syntax errors. When a syntax error occurs, yyerror() is called. However, error_with_pos() is a no-op unless the -w option is provided. You can observe syntax errors by manually passing the -w option. For example, with CONFIG_MODVERSIONS=y on v6.13-rc1: $ make -s KCFLAGS=-D__GENKSYMS__ kernel/module/main.i $ cat kernel/module/main.i | scripts/genksyms/genksyms -w [ snip ] kernel/module/main.c:97: syntax error The syntax error occurs in the following code in kernel/module/main.c: static void __mod_update_bounds(enum mod_mem_type type __maybe_unused, void *base, unsigned int size, struct mod_tree_root *tree) { [ snip ] } The issue arises from __maybe_unused, which is defined as __attribute__((__unused__)). This commit allows direct_abstract_declarator to be followed with attributes. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Acked-by: Nicolas Schier <n.schier@avm.de>
-rw-r--r--scripts/genksyms/parse.y4
1 files changed, 2 insertions, 2 deletions
diff --git a/scripts/genksyms/parse.y b/scripts/genksyms/parse.y
index 49d3e536b9a8..82774df50642 100644
--- a/scripts/genksyms/parse.y
+++ b/scripts/genksyms/parse.y
@@ -383,8 +383,8 @@ abstract_declarator:
ptr_operator
| ptr_operator abstract_declarator
{ $$ = $2 ? $2 : $1; }
- | direct_abstract_declarator
- { $$ = $1; dont_want_type_specifier = false; }
+ | direct_abstract_declarator attribute_opt
+ { $$ = $2; dont_want_type_specifier = false; }
;
direct_abstract_declarator: