]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
modpost: add NOFAIL to strndup
authorDenis Efremov <efremov@linux.com>
Tue, 27 Aug 2019 12:20:23 +0000 (15:20 +0300)
committerMasahiro Yamada <yamada.masahiro@socionext.com>
Wed, 4 Sep 2019 13:55:42 +0000 (22:55 +0900)
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>
scripts/mod/modpost.c

index 2773f9f9bae2880cbf18f940aae54811dcea9b77..76c221dd9b2b62d39037a75c8bd36091b4829de1 100644 (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;