diff options
author | Florin Malita <fmalita@gmail.com> | 2006-06-25 08:48:31 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-25 13:01:15 -0400 |
commit | 0710d36a0fd5db3176369397f0fc49db32a63507 (patch) | |
tree | f1d0de2afccdd6c7f967fc12c752f5323e4e3a8f /fs/9p/vfs_inode.c | |
parent | eab03ac7bd3e0da99eb9dc068772a85a5e3f3577 (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/9p/vfs_inode.c')
-rw-r--r-- | fs/9p/vfs_inode.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c index 2cb87ba4b1c1..8e60dc7ec4a6 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, | |||
1054 | int ret; | 1054 | int ret; |
1055 | char *link = __getname(); | 1055 | char *link = __getname(); |
1056 | 1056 | ||
1057 | if (unlikely(!link)) | ||
1058 | return -ENOMEM; | ||
1059 | |||
1057 | if (buflen > PATH_MAX) | 1060 | if (buflen > PATH_MAX) |
1058 | buflen = PATH_MAX; | 1061 | buflen = PATH_MAX; |
1059 | 1062 | ||
@@ -1227,6 +1230,9 @@ v9fs_vfs_link(struct dentry *old_dentry, struct inode *dir, | |||
1227 | } | 1230 | } |
1228 | 1231 | ||
1229 | name = __getname(); | 1232 | name = __getname(); |
1233 | if (unlikely(!name)) | ||
1234 | return -ENOMEM; | ||
1235 | |||
1230 | sprintf(name, "%d\n", oldfid->fid); | 1236 | sprintf(name, "%d\n", oldfid->fid); |
1231 | retval = v9fs_vfs_mkspecial(dir, dentry, V9FS_DMLINK, name); | 1237 | retval = v9fs_vfs_mkspecial(dir, dentry, V9FS_DMLINK, name); |
1232 | __putname(name); | 1238 | __putname(name); |