提交 0710d36a 编写于 作者: F Florin Malita 提交者: Linus Torvalds

[PATCH] 9pfs: missing result check in v9fs_vfs_readlink() and v9fs_vfs_link()

__getname() may fail and return NULL (as pointed out by Coverity 437 &
1220).
Signed-off-by: NFlorin Malita <fmalita@gmail.com>
Acked-by: NEric Van Hensbergen <ericvh@gmail.com>
Cc: <rminnich@lanl.gov>
Cc: Latchesar Ionkov <lucho@ionkov.net>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 eab03ac7
......@@ -1054,6 +1054,9 @@ static int v9fs_vfs_readlink(struct dentry *dentry, char __user * buffer,
int ret;
char *link = __getname();
if (unlikely(!link))
return -ENOMEM;
if (buflen > PATH_MAX)
buflen = PATH_MAX;
......@@ -1227,6 +1230,9 @@ v9fs_vfs_link(struct dentry *old_dentry, struct inode *dir,
}
name = __getname();
if (unlikely(!name))
return -ENOMEM;
sprintf(name, "%d\n", oldfid->fid);
retval = v9fs_vfs_mkspecial(dir, dentry, V9FS_DMLINK, name);
__putname(name);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册