From 0710d36a0fd5db3176369397f0fc49db32a63507 Mon Sep 17 00:00:00 2001 From: Florin Malita Date: Sun, 25 Jun 2006 05:48:31 -0700 Subject: [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 Acked-by: Eric Van Hensbergen Cc: Cc: Latchesar Ionkov Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- fs/9p/vfs_inode.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'fs/9p/vfs_inode.c') 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); -- cgit v1.2.3-70-g09d2