Thread (3 messages) 3 messages, 3 authors, 2011-09-07

Re: [patch 1/2] 9p: move dereference after NULL check

From: Venkateswararao Jujjuri <hidden>
Date: 2011-09-07 16:09:42
Also in: kernel-janitors

On 08/26/2011 09:55 AM, Dan Carpenter wrote:
We dereferenced "req->tc" and "req->rc" before checking for NULL.

Signed-off-by: Dan Carpenter<redacted>
Reviewed-by: Venkateswararao Jujjuri <redacted>
quoted hunk ↗ jump to hunk
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);
  	}
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help