From 507874c08f633e05f3043c618af0705e0a750e4c Mon Sep 17 00:00:00 2001 From: Colin Ian King Date: Fri, 10 Sep 2021 13:25:34 +0100 Subject: orangefs: Remove redundant initialization of variable ret The variable ret is being initialized with a value that is never read, it is being updated later on. The assignment is redundant and can be removed. Addresses-Coverity: ("Unused value") Signed-off-by: Colin Ian King Signed-off-by: Mike Marshall --- fs/orangefs/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'fs/orangefs') diff --git a/fs/orangefs/super.c b/fs/orangefs/super.c index 2f2e430461b2..897fb6c3f161 100644 --- a/fs/orangefs/super.c +++ b/fs/orangefs/super.c @@ -475,7 +475,7 @@ struct dentry *orangefs_mount(struct file_system_type *fst, const char *devname, void *data) { - int ret = -EINVAL; + int ret; struct super_block *sb = ERR_PTR(-EINVAL); struct orangefs_kernel_op_s *new_op; struct dentry *d = ERR_PTR(-EINVAL); -- cgit v1.2.3 From 4c2b46c824a78fc8190d8eafaaea5a9078fe7479 Mon Sep 17 00:00:00 2001 From: Jia-Ju Bai Date: Tue, 9 Mar 2021 00:00:20 -0800 Subject: fs: orangefs: fix error return code of orangefs_revalidate_lookup() When op_alloc() returns NULL to new_op, no error return code of orangefs_revalidate_lookup() is assigned. To fix this bug, ret is assigned with -ENOMEM in this case. Fixes: 8bb8aefd5afb ("OrangeFS: Change almost all instances of the string PVFS2 to OrangeFS.") Reported-by: TOTE Robot Signed-off-by: Jia-Ju Bai Signed-off-by: Mike Marshall --- fs/orangefs/dcache.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'fs/orangefs') diff --git a/fs/orangefs/dcache.c b/fs/orangefs/dcache.c index fe484cf93e5c..8bbe9486e3a6 100644 --- a/fs/orangefs/dcache.c +++ b/fs/orangefs/dcache.c @@ -26,8 +26,10 @@ static int orangefs_revalidate_lookup(struct dentry *dentry) gossip_debug(GOSSIP_DCACHE_DEBUG, "%s: attempting lookup.\n", __func__); new_op = op_alloc(ORANGEFS_VFS_OP_LOOKUP); - if (!new_op) + if (!new_op) { + ret = -ENOMEM; goto out_put_parent; + } new_op->upcall.req.lookup.sym_follow = ORANGEFS_LOOKUP_LINK_NO_FOLLOW; new_op->upcall.req.lookup.parent_refn = parent->refn; -- cgit v1.2.3 From ac2c63757f4f413980d6c676dbe1ae2941b94afa Mon Sep 17 00:00:00 2001 From: Chenyuan Mi Date: Tue, 7 Sep 2021 19:41:05 +0800 Subject: orangefs: Fix sb refcount leak when allocate sb info failed. The reference counting issue happens in one exception handling path of orangefs_mount(). When failing to allocate sb info, the function forgets to decrease the refcount of sb increased by sget(), causing a refcount leak. Fix this issue by jumping to the label "free_sb_and_op" instead of "free_op" Signed-off-by: Chenyuan Mi Signed-off-by: Xiyu Yang Signed-off-by: Xin Tan Signed-off-by: Mike Marshall --- fs/orangefs/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'fs/orangefs') diff --git a/fs/orangefs/super.c b/fs/orangefs/super.c index 897fb6c3f161..18341cde3f34 100644 --- a/fs/orangefs/super.c +++ b/fs/orangefs/super.c @@ -526,7 +526,7 @@ struct dentry *orangefs_mount(struct file_system_type *fst, sb->s_fs_info = kzalloc(sizeof(struct orangefs_sb_info_s), GFP_KERNEL); if (!ORANGEFS_SB(sb)) { d = ERR_PTR(-ENOMEM); - goto free_op; + goto free_sb_and_op; } ret = orangefs_fill_sb(sb, -- cgit v1.2.3