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>
This commit is contained in:
Denis Efremov 2019-08-27 15:20:23 +03:00 committed by Masahiro Yamada
parent 389c9af7f1
commit 6f02bdfc99
1 changed files with 2 additions and 2 deletions

View File

@ -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;