Skip to contentSkip to conversation

exportfs: fix 'passing zero to ERR_PTR()' warning

PATCH Applied YueHaibing 2 participants 2 messages Nov 19, 2018 Filesystems exportfs

lore
Share & tools
lore

YueHaibing

author
#0 lore raw

PATCH 1/1 exportfs: fix 'passing zero to ERR_PTR()' warning

Fix a static code checker warning:
fs/exportfs/expfs.c:171 reconnect_one() warn: passing zero to 'ERR_PTR'

The error path for lookup_one_len_unlocked failure should set err to PTR_ERR.

Fixes bbf7a8a3562f ("exportfs: move most of reconnect_path to helper function")
---
 fs/exportfs/expfs.c | 1 +
 1 file changed, 1 insertion(+)
fs/exportfs/expfs.c +1 -0
index 645158d..c8a3dfd 100644
@@ -147,6 +147,7 @@ static struct dentry *reconnect_one(struct vfsmount *mnt,
 	tmp = lookup_one_len_unlocked(nbuf, parent, strlen(nbuf));
 	if (IS_ERR(tmp)) {
 		dprintk("%s: lookup failed: %d\n", __func__, PTR_ERR(tmp));
+		err = PTR_ERR(tmp);
 		goto out_err;
 	}
 	if (tmp != dentry) {
Signature · 1 line
2.7.0
Applied
#1 lore raw
Quoted 8 lines · YueHaibing

Fix a static code checker warning:
fs/exportfs/expfs.c:171 reconnect_one() warn: passing zero to 'ERR_PTR'

The error path for lookup_one_len_unlocked failure should set err to PTR_ERR.

Fixes bbf7a8a3562f ("exportfs: move most of reconnect_path to helper function")

Applied.