From: Asias He <asias@redhat.com>
To: Rusty Russell <rusty@rustcorp.com.au>
Cc: virtualization@lists.linux-foundation.org,
kernel-janitors@vger.kernel.org,
Dan Carpenter <dan.carpenter@oracle.com>,
"Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [patch] virtio-blk: fix NULL checking in virtblk_alloc_req()
Date: Thu, 06 Sep 2012 11:04:15 +0800 [thread overview]
Message-ID: <504812AF.5060607@redhat.com> (raw)
In-Reply-To: <871uifj1vr.fsf@rustcorp.com.au>
On 09/06/2012 10:55 AM, Rusty Russell wrote:
> Dan Carpenter <dan.carpenter@oracle.com> writes:
>
>> Smatch complains about the inconsistent NULL checking here. Fix it to
>> return NULL on failure.
>>
>> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>> ---
>> This is only needed in linux-next.
>
> Nice!
>
>> diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
>> index 2edfb5c..457db0c 100644
>> --- a/drivers/block/virtio_blk.c
>> +++ b/drivers/block/virtio_blk.c
>> @@ -90,10 +90,11 @@ static inline struct virtblk_req *virtblk_alloc_req(struct virtio_blk *vblk,
>> struct virtblk_req *vbr;
>>
>> vbr = mempool_alloc(vblk->pool, gfp_mask);
>> - if (vbr && use_bio)
>> - sg_init_table(vbr->sg, vblk->sg_elems);
>> + if (!vbr)
>> + return NULL;
>>
>> - vbr->vblk = vblk;
>> + if (use_bio)
>> + sg_init_table(vbr->sg, vblk->sg_elems);
>>
>> return vbr;
>> }
>
> But it turns out that "vbr->vblk = vblk;" assignment is important :)
I was just replying ;-)
> Fixed and applied,
Thanks Rusty!
--
Asias
next prev parent reply other threads:[~2012-09-06 3:04 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-05 12:32 [patch] virtio-blk: fix NULL checking in virtblk_alloc_req() Dan Carpenter
2012-09-05 13:11 ` Michael S. Tsirkin
2012-09-06 2:55 ` Rusty Russell
2012-09-06 3:04 ` Asias He [this message]
2012-09-06 3:02 ` Asias He
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=504812AF.5060607@redhat.com \
--to=asias@redhat.com \
--cc=dan.carpenter@oracle.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=mst@redhat.com \
--cc=rusty@rustcorp.com.au \
--cc=virtualization@lists.linux-foundation.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).