[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230614143058.112300-1-cymi20@fudan.edu.cn>
Date: Wed, 14 Jun 2023 07:30:58 -0700
From: Chenyuan Mi <cymi20@...an.edu.cn>
To: trond.myklebust@...merspace.com
Cc: anna@...nel.org, linux-nfs@...r.kernel.org,
linux-kernel@...r.kernel.org, Chenyuan Mi <cymi20@...an.edu.cn>
Subject: [PATCH] nfsroot: Fix missing check for return value of strsep()
The strsep() function in root_nfs_parse_options() may return NULL
if argument 'incoming' is NULL. Since 'incoming' has Null check in
this function, it is also need to add Null check for return value
of strsep().
Found by our static analysis tool.
Signed-off-by: Chenyuan Mi <cymi20@...an.edu.cn>
---
fs/nfs/nfsroot.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/nfs/nfsroot.c b/fs/nfs/nfsroot.c
index 620329b7e6ae..55c594dede9f 100644
--- a/fs/nfs/nfsroot.c
+++ b/fs/nfs/nfsroot.c
@@ -198,7 +198,7 @@ static int __init root_nfs_parse_options(char *incoming, char *exppath,
* Set the NFS remote path
*/
p = strsep(&incoming, ",");
- if (*p != '\0' && strcmp(p, "default") != 0)
+ if (p != NULL && *p != '\0' && strcmp(p, "default") != 0)
if (root_nfs_copy(exppath, p, exppathlen))
return -1;
--
2.17.1
Powered by blists - more mailing lists