summaryrefslogtreecommitdiff
path: root/fs/f2fs
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk.kim@samsung.com>2013-01-03 09:24:28 +0900
committerJaegeuk Kim <jaegeuk.kim@samsung.com>2013-01-04 09:46:27 +0900
commitc1b75eabec4eddce55ebb078f84481f58272878f (patch)
tree9d792a10e129791ac70929190a5614ea4ec91bea /fs/f2fs
parentd66d1f76878fcb1e78592fe8aecd13f438d6c0d7 (diff)
downloadlinux-3.10-c1b75eabec4eddce55ebb078f84481f58272878f.tar.gz
linux-3.10-c1b75eabec4eddce55ebb078f84481f58272878f.tar.bz2
linux-3.10-c1b75eabec4eddce55ebb078f84481f58272878f.zip
f2fs: avoid null dereference in f2fs_acl_from_disk
This patch resolves Coverity #751303: >>> CID 753103: Explicit null dereferenced (FORWARD_NULL) Passing null >>> pointer "value" to function "f2fs_acl_from_disk(char const *, size_t)", which dereferences it. [Error path] - value = NULL; - retval = 0 by f2fs_getxattr(); - f2fs_acl_from_disk(value:NULL, ...); Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Diffstat (limited to 'fs/f2fs')
-rw-r--r--fs/f2fs/acl.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/fs/f2fs/acl.c b/fs/f2fs/acl.c
index e95b94945d5..137af4255da 100644
--- a/fs/f2fs/acl.c
+++ b/fs/f2fs/acl.c
@@ -191,15 +191,14 @@ struct posix_acl *f2fs_get_acl(struct inode *inode, int type)
retval = f2fs_getxattr(inode, name_index, "", value, retval);
}
- if (retval < 0) {
- if (retval == -ENODATA)
- acl = NULL;
- else
- acl = ERR_PTR(retval);
- } else {
+ if (retval > 0)
acl = f2fs_acl_from_disk(value, retval);
- }
+ else if (retval == -ENODATA)
+ acl = NULL;
+ else
+ acl = ERR_PTR(retval);
kfree(value);
+
if (!IS_ERR(acl))
set_cached_acl(inode, type, acl);