From: David Howells <dhowells@redhat.com>
To: colin.king@canonical.com
Cc: Joe Perches <joe@perches.com>,
joe@perches.com, jaltman@auristor.com,
linux-afs@lists.infradead.org, dhowells@redhat.com,
kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 1/2] afs: Fix incorrect error handling in afs_xattr_get_acl()
Date: Sun, 12 May 2019 08:45:41 +0100 [thread overview]
Message-ID: <155764714099.24080.1233326575922058381.stgit@warthog.procyon.org.uk> (raw)
Fix incorrect error handling in afs_xattr_get_acl() where there appears to
be a redundant assignment before return, but in fact the return should be a
goto to the error handling at the end of the function.
Fixes: 260f082bae6d ("afs: Get an AFS3 ACL as an xattr")
Addresses-Coverity: ("Unused Value")
Reported-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Joe Perches <joe@perches.com>
---
fs/afs/xattr.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/fs/afs/xattr.c b/fs/afs/xattr.c
index c81f85003fc7..b6c44e75b361 100644
--- a/fs/afs/xattr.c
+++ b/fs/afs/xattr.c
@@ -71,11 +71,10 @@ static int afs_xattr_get_acl(const struct xattr_handler *handler,
if (ret == 0) {
ret = acl->size;
if (size > 0) {
- ret = -ERANGE;
- if (acl->size > size)
- return -ERANGE;
- memcpy(buffer, acl->data, acl->size);
- ret = acl->size;
+ if (acl->size <= size)
+ memcpy(buffer, acl->data, acl->size);
+ else
+ ret = -ERANGE;
}
kfree(acl);
}
next reply other threads:[~2019-05-12 7:45 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-12 7:45 David Howells [this message]
2019-05-12 7:45 ` [PATCH 2/2] afs: Fix afs_xattr_get_yfs() to not try freeing an error value David Howells
2019-05-12 16:07 ` walter harms
2019-05-12 18:10 ` David Howells
2019-05-12 18:44 ` walter harms
2019-05-12 20:06 ` David Howells
2019-05-13 10:13 ` walter harms
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=155764714099.24080.1233326575922058381.stgit@warthog.procyon.org.uk \
--to=dhowells@redhat.com \
--cc=colin.king@canonical.com \
--cc=jaltman@auristor.com \
--cc=joe@perches.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-afs@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).