[PATCH] fs: fix name check in pseudofs::lookup()

13 views
Skip to first unread message

Fotis Xenakis

unread,
Mar 23, 2020, 1:01:48 PM3/23/20
to osv...@googlegroups.com, Fotis Xenakis
Signed-off-by: Fotis Xenakis <fo...@windowslive.com>
---
fs/pseudofs/pseudofs.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/pseudofs/pseudofs.cc b/fs/pseudofs/pseudofs.cc
index 4d37dc66..b721d950 100644
--- a/fs/pseudofs/pseudofs.cc
+++ b/fs/pseudofs/pseudofs.cc
@@ -97,7 +97,7 @@ int lookup(vnode *dvp, char *name, vnode **vpp) {

*vpp = nullptr;

- if (!*name || !parent) {
+ if (!name || !parent) {
return ENOENT;
}
auto node = parent->lookup(name);
--
2.25.2

Fotis Xenakis

unread,
Mar 23, 2020, 1:10:13 PM3/23/20
to OSv Development
I was reading through the filesystem code and noticed this check which seemed wrong (given the type of name). If it was right, please ignore this patch.

Waldek Kozaczuk

unread,
Mar 27, 2020, 12:35:30 PM3/27/20
to OSv Development
I think this code is consistent with other filesystems code. We do not check if the name parameter is null, we only check that the name string is not empty. I think the null check is done in higher layers but doing extra check here might not hurt.
Reply all
Reply to author
Forward
0 new messages