summaryrefslogtreecommitdiffstats
path: root/scripts/mod
diff options
context:
space:
mode:
authorDenis Efremov <efremov@linux.com>2019-08-27 14:20:23 +0200
committerMasahiro Yamada <yamada.masahiro@socionext.com>2019-09-04 15:55:42 +0200
commit6f02bdfc995f098bde87216c122ade2b46f971b5 (patch)
treee80a876ff957c1ecd1e0d73b127fa350be326117 /scripts/mod
parentmodpost: add guid_t type definition (diff)
downloadlinux-6f02bdfc995f098bde87216c122ade2b46f971b5.tar.xz
linux-6f02bdfc995f098bde87216c122ade2b46f971b5.zip
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 <efremov@linux.com> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Diffstat (limited to 'scripts/mod')
-rw-r--r--scripts/mod/modpost.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 2773f9f9bae2..76c221dd9b2b 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;