Skip to content

Commit 6f02bdf

Browse files
evdenismasahir0y
authored andcommitted
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 <[email protected]> Signed-off-by: Masahiro Yamada <[email protected]>
1 parent 389c9af commit 6f02bdf

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

scripts/mod/modpost.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -797,9 +797,9 @@ static int match(const char *sym, const char * const pat[])
797797

798798
/* "*foo*" */
799799
if (*p == '*' && *endp == '*') {
800-
char *here, *bare = strndup(p + 1, strlen(p) - 2);
800+
char *bare = NOFAIL(strndup(p + 1, strlen(p) - 2));
801+
char *here = strstr(sym, bare);
801802

802-
here = strstr(sym, bare);
803803
free(bare);
804804
if (here != NULL)
805805
return 1;

0 commit comments

Comments
 (0)