modpost: List all GPL-only symbols used by GPL-incompatible modules
PATCH 1/1 modpost: List all GPL-only symbols used by GPL-incompatible modules
modpost currently exits after hitting the first GPL-only symbol used by a GPL-incompatible module. Delay the failure until all symbols have been processed in order to print all cases rather than just the first.
Signed-off-by Matthew Garrett <[email protected]>
--- scripts/mod/modpost.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-)
scripts/mod/modpost.c +14 -9
@@ -2056,29 +2056,30 @@ void buf_write(struct buffer *buf, const char *s, int len) buf->pos += len; } -static void check_for_gpl_usage (enum export exp,const char *m,const char *s) +static int check_for_gpl_usage (enum export exp,const char *m,const char *s) {const char *e =is_vmlinux (m) ?"" :".ko" ;switch (exp) {case export_gpl: -fatal ("modpost: GPL-incompatible module %s%s " +warn ("modpost: GPL-incompatible module %s%s " "uses GPL-only symbol '%s'\n" , m, e, s); -break ; +return 1 ;case export_unused_gpl: -fatal ("modpost: GPL-incompatible module %s%s " +warn ("modpost: GPL-incompatible module %s%s " "uses GPL-only symbol marked UNUSED '%s'\n" , m, e, s); -break ; +return 1 ;case export_gpl_future:warn ("modpost: GPL-incompatible module %s%s " "uses future GPL-only symbol '%s'\n" , m, e, s); -break ; +return 0 ;case export_plain:case export_unused:case export_unknown:/* ignore */ -break ; +return 0 ; } +return 0 ; }static void check_for_unused (enum export exp,const char *m,const char *s)
@@ -2100,6 +2101,7 @@ static void check_for_unused(enum export exp, const char *m, const char *s)static void check_exports (struct module *mod) {struct symbol *s, *exp; +int symbol_mismatch =0 ;for (s = mod->unres; s; s = s->next) {const char *basename;
@@ -2111,10 +2113,13 @@ static void check_exports(struct module *mod) basename++; else basename = mod->name; -if (!mod->gpl_compatible) -check_for_gpl_usage (exp->export, basename, exp->name); +if (!mod->gpl_compatible && +check_for_gpl_usage (exp->export, basename, exp->name)) + symbol_mismatch =1 ;check_for_unused (exp->export, basename, exp->name); } +if (symbol_mismatch) +fatal ("Module violates symbol usage policy\n" ); }static int check_modname_len (struct module *mod)
Signature · 1 line
2.16.0.rc1.238.g530d649a79-goog