Skip to content

Commit

Permalink
[PATCH] 9pfs: missing result check in v9fs_vfs_readlink() and v9fs_vf…
Browse files Browse the repository at this point in the history
…s_link()

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

Signed-off-by: Florin Malita <[email protected]>
Acked-by: Eric Van Hensbergen <[email protected]>
Cc: <[email protected]>
Cc: Latchesar Ionkov <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
fmalita authored and Linus Torvalds committed Jun 25, 2006
1 parent eab03ac commit 0710d36
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions fs/9p/vfs_inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 0710d36

Please sign in to comment.