From: hch@lst.de (Christoph Hellwig)
Subject: [PATCH V2] nvme-pci: fix NULL pointer reference in nvme_alloc_ns
Date: Thu, 4 Jan 2018 11:20:33 +0100 [thread overview]
Message-ID: <20180104102033.GA4834@lst.de> (raw)
In-Reply-To: <1515112799-1678-1-git-send-email-jianchao.w.wang@oracle.com>
This looks generally fine to me, ut a few nitpicks below:
> - Based on Sagi's suggestion, add new state NVME_CTRL_ADMIN_LIVE.
Maybe call this NVME_CTRL_ADMIN_ONLY ?
> - if (ctrl->state != NVME_CTRL_LIVE)
> + if ((ctrl->state != NVME_CTRL_LIVE) &&
> + (ctrl->state != NVME_CTRL_ADMIN_LIVE))
No need for the inner braces, and odd indentation. Also in general
I'm tempted to just use switch statements for things like this, e.g.
switch (ctrl->state) {
case NVME_CTRL_ADMIN_LIVE:
case NVME_CTRL_LIVE:
break;
default:
return -EWOULDBLOCK;
}
> @@ -3074,6 +3087,8 @@ static void nvme_scan_work(struct work_struct *work)
> if (ctrl->state != NVME_CTRL_LIVE)
> return;
>
> + BUG_ON(!ctrl->tagset);
WARN_ON_ONCE() please.
> + bool only_adminq = false;
How about a new_state variable instead that holds the new state value?
WARNING: multiple messages have this Message-ID (diff)
From: Christoph Hellwig <hch@lst.de>
To: Jianchao Wang <jianchao.w.wang@oracle.com>
Cc: keith.busch@intel.com, axboe@fb.com, hch@lst.de,
sagi@grimberg.me, linux-nvme@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH V2] nvme-pci: fix NULL pointer reference in nvme_alloc_ns
Date: Thu, 4 Jan 2018 11:20:33 +0100 [thread overview]
Message-ID: <20180104102033.GA4834@lst.de> (raw)
In-Reply-To: <1515112799-1678-1-git-send-email-jianchao.w.wang@oracle.com>
This looks generally fine to me, ut a few nitpicks below:
> - Based on Sagi's suggestion, add new state NVME_CTRL_ADMIN_LIVE.
Maybe call this NVME_CTRL_ADMIN_ONLY ?
> - if (ctrl->state != NVME_CTRL_LIVE)
> + if ((ctrl->state != NVME_CTRL_LIVE) &&
> + (ctrl->state != NVME_CTRL_ADMIN_LIVE))
No need for the inner braces, and odd indentation. Also in general
I'm tempted to just use switch statements for things like this, e.g.
switch (ctrl->state) {
case NVME_CTRL_ADMIN_LIVE:
case NVME_CTRL_LIVE:
break;
default:
return -EWOULDBLOCK;
}
> @@ -3074,6 +3087,8 @@ static void nvme_scan_work(struct work_struct *work)
> if (ctrl->state != NVME_CTRL_LIVE)
> return;
>
> + BUG_ON(!ctrl->tagset);
WARN_ON_ONCE() please.
> + bool only_adminq = false;
How about a new_state variable instead that holds the new state value?
next prev parent reply other threads:[~2018-01-04 10:20 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-05 0:39 [PATCH V2] nvme-pci: fix NULL pointer reference in nvme_alloc_ns Jianchao Wang
2018-01-05 0:39 ` Jianchao Wang
2018-01-04 10:20 ` Christoph Hellwig [this message]
2018-01-04 10:20 ` Christoph Hellwig
2018-01-05 3:44 ` jianchao.wang
2018-01-05 3:44 ` jianchao.wang
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=20180104102033.GA4834@lst.de \
--to=hch@lst.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.