modpost: add NOFAIL to strdup call
PATCH 1/1 modpost: add NOFAIL to strdup call
Add NOFAIL check for the strdup call, since the function allocates memory and can return NULL. All strdup calls in modpost are checked with NOFAIL.
Signed-off-by Denis Efremov <[email protected]>
--- scripts/mod/modpost.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/mod/modpost.c +1 -1
@@ -384,7 +384,7 @@ static struct symbol *sym_add_exported(const char *name, const char *namespace, } }free (s->namespace); - s->namespace = namespace ?strdup (namespace) :NULL ; + s->namespace = namespace ?NOFAIL (strdup (namespace)) :NULL ; s->preloaded =0 ; s->vmlinux =is_vmlinux (mod->name); s->kernel =0 ;
Signature · 1 line
2.21.0
Quoted 15 lines · Denis Efremov
Add NOFAIL check for the strdup call, since the function allocates memory and can return NULL. All strdup calls in modpost are checked with NOFAIL.
Signed-off-by Denis Efremov <[email protected]>--- scripts/mod/modpost.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)scripts/mod/modpost.c +0
-0
scripts/mod/modpost.c static struct symbol *sym_add_exported(const char *name, const char *namespace, · line 387
Quoted 5 lines
scripts/mod/modpost.c +1
-1@@ -384,7 +384,7 @@ static struct symbol *sym_add_exported(const char *name, const char *namespace, } }free (s->namespace); - s->namespace = namespace ?strdup (namespace) :NULL ; + s->namespace = namespace ?NOFAIL (strdup (namespace)) :NULL ;
This is correct, but I will put it off
because otherwise if would cause a conflict against this patch:
https://lore.kernel.org/patchwork/patch/1138151/
That patch is adding NOFAIL().
Quoted 6 lines
scripts/mod/modpost.c +0
-1s->preloaded =0 ; s->vmlinux =is_vmlinux (mod->name); s->kernel =0 ; --2.21.0
Signature · 2 lines
Best Regards Masahiro Yamada