Skip to contentSkip to conversation

orangefs: fix unused value in __orangefs_setattr

PATCH New Gustavo A. R. Silva 1 participant 1 message May 27, 2019 Orangefs filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 orangefs: fix unused value in __orangefs_setattr

Add check for the return value of posix_acl_chmod() and fix unused value bug.

Notice that if this check is not in place, the value in ret is overwritten at line 913, before it can be used:

913 ret = 0;

Addresses-Coverity-ID: 1445565 ("Unused value")

Fixes df2d7337b570 ("orangefs: let setattr write to cached inode")
---
 fs/orangefs/inode.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
fs/orangefs/inode.c +4 -1
index 0c337d8bdaab..3608f183d075 100644
@@ -906,9 +906,12 @@ int __orangefs_setattr(struct inode *inode, struct iattr *iattr)
 	spin_unlock(&inode->i_lock);
 	mark_inode_dirty(inode);
 
-	if (iattr->ia_valid & ATTR_MODE)
+	if (iattr->ia_valid & ATTR_MODE) {
 		/* change mod on a file that has ACLs */
 		ret = posix_acl_chmod(inode, inode->i_mode);
+		if (ret)
+			goto out;
+	}
 
 	ret = 0;
 out:
Signature · 1 line
2.21.0