linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] modpost: add NOFAIL to strdup call
@ 2019-10-15  6:49 Denis Efremov
  2019-10-17  0:00 ` Masahiro Yamada
  0 siblings, 1 reply; 2+ messages in thread
From: Denis Efremov @ 2019-10-15  6:49 UTC (permalink / raw)
  To: linux-kbuild; +Cc: Denis Efremov, Masahiro Yamada, Michal Marek, linux-kernel

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 <efremov@linux.com>
---
 scripts/mod/modpost.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 936d3ad23c83..8e8975065cbc 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -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;
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] modpost: add NOFAIL to strdup call
  2019-10-15  6:49 [PATCH] modpost: add NOFAIL to strdup call Denis Efremov
@ 2019-10-17  0:00 ` Masahiro Yamada
  0 siblings, 0 replies; 2+ messages in thread
From: Masahiro Yamada @ 2019-10-17  0:00 UTC (permalink / raw)
  To: Denis Efremov
  Cc: Linux Kbuild mailing list, Michal Marek, Linux Kernel Mailing List

On Tue, Oct 15, 2019 at 3:49 PM Denis Efremov <efremov@linux.com> wrote:
>
> 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 <efremov@linux.com>
> ---
>  scripts/mod/modpost.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
> index 936d3ad23c83..8e8975065cbc 100644
> --- a/scripts/mod/modpost.c
> +++ b/scripts/mod/modpost.c
> @@ -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().




>         s->preloaded = 0;
>         s->vmlinux   = is_vmlinux(mod->name);
>         s->kernel    = 0;
> --
> 2.21.0
>


-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-10-17  0:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-15  6:49 [PATCH] modpost: add NOFAIL to strdup call Denis Efremov
2019-10-17  0:00 ` Masahiro Yamada

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).