From: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
To: Dan Carpenter <error27@gmail.com>
Cc: Eric Van Hensbergen <ericvh@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
"Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>,
"M. Mohan Kumar" <mohan@in.ibm.com>,
"open list:NETWORKING [GENERAL]" <netdev@vger.kernel.org>,
kernel-janitors@vger.kernel.org
Subject: Re: [patch 1/2] 9p: move dereference after NULL check
Date: Wed, 07 Sep 2011 08:31:16 -0700 [thread overview]
Message-ID: <4E678E44.1020204@linux.vnet.ibm.com> (raw)
In-Reply-To: <20110826165559.GE3775@shale.localdomain>
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);
> }
prev parent reply other threads:[~2011-09-07 16:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
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 message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4E678E44.1020204@linux.vnet.ibm.com \
--to=jvrao@linux.vnet.ibm.com \
--cc=aneesh.kumar@linux.vnet.ibm.com \
--cc=davem@davemloft.net \
--cc=ericvh@gmail.com \
--cc=error27@gmail.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=mohan@in.ibm.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).