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

* Re: [patch 1/2] 9p: move dereference after NULL check
  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
  1 sibling, 0 replies; 3+ messages in thread
From: Aneesh Kumar K.V @ 2011-08-30  7:39 UTC (permalink / raw)
  To: Dan Carpenter, Eric Van Hensbergen
  Cc: David S. Miller, Venkateswararao Jujjuri, M. Mohan Kumar,
	open list:NETWORKING [GENERAL], kernel-janitors

On Fri, 26 Aug 2011 19:55:59 +0300, Dan Carpenter <error27@gmail.com> wrote:
> 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);
>  	}

Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>

-aneesh

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

* Re: [patch 1/2] 9p: move dereference after NULL check
  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
  1 sibling, 0 replies; 3+ messages in thread
From: Venkateswararao Jujjuri @ 2011-09-07 15:31 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Eric Van Hensbergen, David S. Miller, Aneesh Kumar K.V,
	M. Mohan Kumar, open list:NETWORKING [GENERAL], 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<error27@gmail.com>
Reviewed-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.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	[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).