Skip to content

Commit

Permalink
modpost: add NOFAIL to strndup
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Denis Efremov authored and Masahiro Yamada committed Sep 4, 2019
1 parent 389c9af commit 6f02bdf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions scripts/mod/modpost.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 6f02bdf

Please sign in to comment.