summaryrefslogtreecommitdiffstats
path: root/net/9p/client.c
diff options
context:
space:
mode:
authorDan Carpenter <error27@gmail.com>2011-08-26 18:55:59 +0200
committerEric Van Hensbergen <ericvh@gmail.com>2011-10-24 18:13:11 +0200
commit5635fd0ccf4ce90a9ecf8fa48f5f031f5f73e6f5 (patch)
treea6a7320929b5e9bc08c5bf9b9f1623c9bc576016 /net/9p/client.c
parentfs/9p: inode file operation is properly initialized init_special_inode (diff)
downloadlinux-5635fd0ccf4ce90a9ecf8fa48f5f031f5f73e6f5.tar.xz
linux-5635fd0ccf4ce90a9ecf8fa48f5f031f5f73e6f5.zip
9p: move dereference after NULL check
We dereferenced "req->tc" and "req->rc" before checking for NULL. Signed-off-by: Dan Carpenter <error27@gmail.com> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
Diffstat (limited to '')
-rw-r--r--net/9p/client.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/net/9p/client.c b/net/9p/client.c
index 305a4e719b03..9eadadb0a698 100644
--- a/net/9p/client.c
+++ b/net/9p/client.c
@@ -248,10 +248,8 @@ static struct p9_req_t *p9_tag_alloc(struct p9_client *c, u16 tag, int max_size)
init_waitqueue_head(req->wq);
req->tc = kmalloc(sizeof(struct p9_fcall) + alloc_msize,
GFP_NOFS);
- req->tc->capacity = alloc_msize;
req->rc = kmalloc(sizeof(struct p9_fcall) + alloc_msize,
GFP_NOFS);
- req->rc->capacity = alloc_msize;
if ((!req->tc) || (!req->rc)) {
printk(KERN_ERR "Couldn't grow tag array\n");
kfree(req->tc);
@@ -261,6 +259,8 @@ static struct p9_req_t *p9_tag_alloc(struct p9_client *c, u16 tag, int max_size)
req->wq = NULL;
return ERR_PTR(-ENOMEM);
}
+ req->tc->capacity = alloc_msize;
+ req->rc->capacity = alloc_msize;
req->tc->sdata = (char *) req->tc + sizeof(struct p9_fcall);
req->rc->sdata = (char *) req->rc + sizeof(struct p9_fcall);
}