diff options
author | David Howells <dhowells@redhat.com> | 2019-05-12 03:05:10 -0400 |
---|---|---|
committer | David Howells <dhowells@redhat.com> | 2019-05-15 12:35:53 -0400 |
commit | cc1dd5c85cb70ebe09ccf1cc34f29af65442a10f (patch) | |
tree | ed2537da920f3e01d06d8fd340e0b214c5a9285a /fs/afs | |
parent | a1b879eefc2b34cd3f17187ef6fc1cf3960e9518 (diff) |
afs: Fix incorrect error handling in afs_xattr_get_acl()
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>
Diffstat (limited to 'fs/afs')
-rw-r--r-- | fs/afs/xattr.c | 9 |
1 files 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, | |||
71 | if (ret == 0) { | 71 | if (ret == 0) { |
72 | ret = acl->size; | 72 | ret = acl->size; |
73 | if (size > 0) { | 73 | if (size > 0) { |
74 | ret = -ERANGE; | 74 | if (acl->size <= size) |
75 | if (acl->size > size) | 75 | memcpy(buffer, acl->data, acl->size); |
76 | return -ERANGE; | 76 | else |
77 | memcpy(buffer, acl->data, acl->size); | 77 | ret = -ERANGE; |
78 | ret = acl->size; | ||
79 | } | 78 | } |
80 | kfree(acl); | 79 | kfree(acl); |
81 | } | 80 | } |