From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
To: Mike Marshall <hubcap@omnibond.com>,
Martin Brandenburg <martin@omnibond.com>
Cc: devel@lists.orangefs.org, linux-kernel@vger.kernel.org,
"Gustavo A. R. Silva" <gustavo@embeddedor.com>
Subject: [PATCH] orangefs: fix unused value in __orangefs_setattr
Date: Mon, 27 May 2019 12:21:58 -0500 [thread overview]
Message-ID: <20190527172158.GA28107@embeddedor> (raw)
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")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
fs/orangefs/inode.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/fs/orangefs/inode.c b/fs/orangefs/inode.c
index 0c337d8bdaab..3608f183d075 100644
--- a/fs/orangefs/inode.c
+++ b/fs/orangefs/inode.c
@@ -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:
--
2.21.0
reply other threads:[~2019-05-27 17:22 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190527172158.GA28107@embeddedor \
--to=gustavo@embeddedor.com \
--cc=devel@lists.orangefs.org \
--cc=hubcap@omnibond.com \
--cc=linux-kernel@vger.kernel.org \
--cc=martin@omnibond.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox