netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch 1/2] 9p: move dereference after NULL check
@ 2011-08-26 16:55 Dan Carpenter
  2011-08-30  7:39 ` Aneesh Kumar K.V
  2011-09-07 15:31 ` Venkateswararao Jujjuri
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2011-08-26 16:55 UTC (permalink / raw)
  To: Eric Van Hensbergen
  Cc: David S. Miller, Venkateswararao Jujjuri, Aneesh Kumar K.V,
	M. Mohan Kumar, open list:NETWORKING [GENERAL], kernel-janitors

We dereferenced "req->tc" and "req->rc" before checking for NULL.

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/net/9p/client.c b/net/9p/client.c
index 3f8c046..b0bcace 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);
 	}

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-09-07 16:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-26 16:55 [patch 1/2] 9p: move dereference after NULL check Dan Carpenter
2011-08-30  7:39 ` Aneesh Kumar K.V
2011-09-07 15:31 ` Venkateswararao Jujjuri

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).