From: Jens Axboe <axboe@fb.com>
To: Dan Carpenter <dan.carpenter@oracle.com>, Christoph Hellwig <hch@lst.de>
Cc: Johannes Thumshirn <jthumshirn@suse.de>,
Hannes Reinecke <hare@suse.com>,
Bart Van Assche <Bart.VanAssche@sandisk.com>,
Sachin Shukla <sachin.s5@samsung.com>,
Pan Bian <bianpan2016@163.com>, Ming Lei <tom.leiming@gmail.com>,
Eric Biggers <ebiggers@google.com>,
Mike Christie <mchristi@redhat.com>,
Dan Williams <dan.j.williams@intel.com>,
<linux-kernel@vger.kernel.org>, <kernel-janitors@vger.kernel.org>
Subject: Re: [PATCH] mtip32xx: Uninitialized variable in mtip_no_dev_cleanup()
Date: Fri, 21 Apr 2017 13:39:54 -0600 [thread overview]
Message-ID: <0bb97411-d1bd-5c6c-69d0-a7bceb69efa7@fb.com> (raw)
In-Reply-To: <20170421193717.u2cxdq2jyithqqxi@mwanda>
On 04/21/2017 01:37 PM, Dan Carpenter wrote:
> We set "cmd->state = -ENODEV;" but "cmd" hasn't been initialized yet.
> It's weird that GCC doesn't catch this.
That is weird...
> diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c
> index 66a6bd83faae..bd4bf70a5bcd 100644
> --- a/drivers/block/mtip32xx/mtip32xx.c
> +++ b/drivers/block/mtip32xx/mtip32xx.c
> @@ -4105,14 +4105,12 @@ static int mtip_block_initialize(struct driver_data *dd)
> static void mtip_no_dev_cleanup(struct request *rq, void *data, bool reserv)
> {
> struct driver_data *dd = (struct driver_data *)data;
> - struct mtip_cmd *cmd;
> + struct mtip_cmd *cmd = mtip_cmd_from_tag(dd, MTIP_TAG_INTERNAL);
>
> if (likely(!reserv)) {
> cmd->status = -ENODEV;
> blk_mq_complete_request(rq);
> } else if (test_bit(MTIP_PF_IC_ACTIVE_BIT, &dd->port->flags)) {
> -
> - cmd = mtip_cmd_from_tag(dd, MTIP_TAG_INTERNAL);
> if (cmd->comp_func)
> cmd->comp_func(dd->port, MTIP_TAG_INTERNAL,
> cmd, -ENODEV);
This is wrong, you can't use the internal tag bit for both cases. A proper
fix was already merged earlier today:
http://git.kernel.dk/cgit/linux-block/commit/?h=for-4.12/block&id=95c55ff425faa190fd8ba55090fbdf33d8b2f0ae
--
Jens Axboe
prev parent reply other threads:[~2017-04-21 19:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-21 19:37 Dan Carpenter
2017-04-21 19:39 ` Jens Axboe [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=0bb97411-d1bd-5c6c-69d0-a7bceb69efa7@fb.com \
--to=axboe@fb.com \
--cc=Bart.VanAssche@sandisk.com \
--cc=bianpan2016@163.com \
--cc=dan.carpenter@oracle.com \
--cc=dan.j.williams@intel.com \
--cc=ebiggers@google.com \
--cc=hare@suse.com \
--cc=hch@lst.de \
--cc=jthumshirn@suse.de \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mchristi@redhat.com \
--cc=sachin.s5@samsung.com \
--cc=tom.leiming@gmail.com \
/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
all inboxes | Powered by JetHome®