From: Denis Efremov Date: Tue, 27 Aug 2019 12:20:23 +0000 (+0300) Subject: modpost: add NOFAIL to strndup X-Git-Tag: v5.4-rc1~105^2~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6f02bdfc995f098bde87216c122ade2b46f971b5;p=thirdparty%2Flinux.git modpost: add NOFAIL to strndup Add NOFAIL check for the strndup call, because the function allocates memory and can return NULL. All calls to strdup in modpost are checked with NOFAIL. Signed-off-by: Denis Efremov Signed-off-by: Masahiro Yamada --- diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 2773f9f9bae28..76c221dd9b2b6 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -797,9 +797,9 @@ static int match(const char *sym, const char * const pat[]) /* "*foo*" */ if (*p == '*' && *endp == '*') { - char *here, *bare = strndup(p + 1, strlen(p) - 2); + char *bare = NOFAIL(strndup(p + 1, strlen(p) - 2)); + char *here = strstr(sym, bare); - here = strstr(sym, bare); free(bare); if (here != NULL) return 1;