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

From: Florin Malita
Date: Thu Jun 08 2006 - 01:34:55 EST


__getname() may fail and return NULL (as pointed out by Coverity 437 &
1220).

Signed-off-by: Florin Malita <fmalita@xxxxxxxxx>
---

fs/9p/vfs_inode.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
index 2cb87ba..8e60dc7 100644
--- a/fs/9p/vfs_inode.c
+++ b/fs/9p/vfs_inode.c
@@ -1054,6 +1054,9 @@ static int v9fs_vfs_readlink(struct dent
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,
}

name = __getname();
+ if (unlikely(!name))
+ return -ENOMEM;
+
sprintf(name, "%d\n", oldfid->fid);
retval = v9fs_vfs_mkspecial(dir, dentry, V9FS_DMLINK, name);
__putname(name);


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/