KBUILD: prevent building modules that wont load
PATCH 3/4 KBUILD: prevent building modules that wont load
From: Andreas Gruenbacher <[email protected]>
Implements license compliance testing in modpost. This prevents kbuild from producing modules that won't load.
Signed-off-by Ram Pai <[email protected]>
Signed-off-by Andreas Gruenbacher <[email protected]>
include/linux/license.h | 14 ++++++++++ kernel/module.c | 11 -------- scripts/mod/modpost.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++-- scripts/mod/modpost.h | 1 4 files changed, 76 insertions(+), 12 deletions(-)
include/linux/license.h new file +14 -0
@@ -0,0 +1,14 @@ +#ifndef __LICENSE_H +#define __LICENSE_H + +static inline int license_is_gpl_compatible (const char *license) +{ +return (strcmp (license,"GPL" ) ==0 + ||strcmp (license,"GPL v2" ) ==0 + ||strcmp (license,"GPL and additional rights" ) ==0 + ||strcmp (license,"Dual BSD/GPL" ) ==0 + ||strcmp (license,"Dual MIT/GPL" ) ==0 + ||strcmp (license,"Dual MPL/GPL" ) ==0 ); +} + +#endif
kernel/module.c +1 -10
@@ -43,6 +43,7 @@#include <asm/uaccess.h> #include <asm/semaphore.h> #include <asm/cacheflush.h> +#include <linux/license.h> #if 0 #define DEBUGP printk
@@ -1248,16 +1249,6 @@ static void layout_sections(struct modul } } -static inline int license_is_gpl_compatible (const char *license) -{ -return (strcmp (license,"GPL" ) ==0 - ||strcmp (license,"GPL v2" ) ==0 - ||strcmp (license,"GPL and additional rights" ) ==0 - ||strcmp (license,"Dual BSD/GPL" ) ==0 - ||strcmp (license,"Dual MIT/GPL" ) ==0 - ||strcmp (license,"Dual MPL/GPL" ) ==0 ); -} -static void set_license (struct module *mod,const char *license) {if (!license)
scripts/mod/modpost.c +60 -2
115 lines not on this page · raw message
scripts/mod/modpost.h +1 -0
@@ -81,6 +81,7 @@ buf_write(struct buffer *buf, const charstruct module {struct module *next;const char *name; +int gpl_compatible;struct symbol *unres;int seen;int skip;