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>
This commit is contained in:
Jaegeuk Kim 2013-01-03 09:24:28 +09:00
Родитель d66d1f7687
Коммит c1b75eabec
1 изменённых файлов: 6 добавлений и 7 удалений

Просмотреть файл

@ -191,15 +191,14 @@ struct posix_acl *f2fs_get_acl(struct inode *inode, int type)
retval = f2fs_getxattr(inode, name_index, "", value, retval); retval = f2fs_getxattr(inode, name_index, "", value, retval);
} }
if (retval < 0) { if (retval > 0)
if (retval == -ENODATA)
acl = NULL;
else
acl = ERR_PTR(retval);
} else {
acl = f2fs_acl_from_disk(value, retval); acl = f2fs_acl_from_disk(value, retval);
} else if (retval == -ENODATA)
acl = NULL;
else
acl = ERR_PTR(retval);
kfree(value); kfree(value);
if (!IS_ERR(acl)) if (!IS_ERR(acl))
set_cached_acl(inode, type, acl); set_cached_acl(inode, type, acl);