aboutsummaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorFlorin Malita <fmalita@gmail.com>2006-06-25 05:48:31 -0700
committerLinus Torvalds <torvalds@g5.osdl.org>2006-06-25 10:01:15 -0700
commit0710d36a0fd5db3176369397f0fc49db32a63507 (patch)
treef1d0de2afccdd6c7f967fc12c752f5323e4e3a8f /fs
parenteab03ac7bd3e0da99eb9dc068772a85a5e3f3577 (diff)
[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: Florin Malita <fmalita@gmail.com> Acked-by: Eric Van Hensbergen <ericvh@gmail.com> Cc: <rminnich@lanl.gov> Cc: Latchesar Ionkov <lucho@ionkov.net> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/9p/vfs_inode.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
index 2cb87ba4b1c..8e60dc7ec4a 100644
--- a/fs/9p/vfs_inode.c
+++ b/fs/9p/vfs_inode.c
@@ -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);