All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Wu Bo <wubo40@huawei.com>
Cc: kbusch@kernel.org, axboe@fb.com, hch@lst.de, sagi@grimberg.me,
	linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org,
	linfeilong@huawei.com
Subject: Re: [PATCH] nvme-multipath: combine grpid and ANA state checks in nvme_parse_ana_log()
Date: Tue, 8 Jun 2021 07:23:20 +0200	[thread overview]
Message-ID: <20210608052320.GA13828@lst.de> (raw)
In-Reply-To: <1623125616-629270-1-git-send-email-wubo40@huawei.com>

On Tue, Jun 08, 2021 at 12:13:36PM +0800, Wu Bo wrote:
> -		if (WARN_ON_ONCE(desc->grpid == 0))
> +		if (WARN_ON_ONCE(desc->grpid == 0 ||
> +			le32_to_cpu(desc->grpid) > ctrl->anagrpmax))
>  			return -EINVAL;
> -		if (WARN_ON_ONCE(le32_to_cpu(desc->grpid) > ctrl->anagrpmax))
> -			return -EINVAL;
> -		if (WARN_ON_ONCE(desc->state == 0))
> -			return -EINVAL;
> -		if (WARN_ON_ONCE(desc->state > NVME_ANA_CHANGE))
> +		if (WARN_ON_ONCE(desc->state == 0 ||
> +			desc->state > NVME_ANA_CHANGE))

So besides making the code impossibl to read due to the incorrect
indentation this also makes each WARN_ON_ONCE cover multiple conditions.
Not very useful for debugging.

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

WARNING: multiple messages have this Message-ID (diff)
From: Christoph Hellwig <hch@lst.de>
To: Wu Bo <wubo40@huawei.com>
Cc: kbusch@kernel.org, axboe@fb.com, hch@lst.de, sagi@grimberg.me,
	linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org,
	linfeilong@huawei.com
Subject: Re: [PATCH] nvme-multipath: combine grpid and ANA state checks in nvme_parse_ana_log()
Date: Tue, 8 Jun 2021 07:23:20 +0200	[thread overview]
Message-ID: <20210608052320.GA13828@lst.de> (raw)
In-Reply-To: <1623125616-629270-1-git-send-email-wubo40@huawei.com>

On Tue, Jun 08, 2021 at 12:13:36PM +0800, Wu Bo wrote:
> -		if (WARN_ON_ONCE(desc->grpid == 0))
> +		if (WARN_ON_ONCE(desc->grpid == 0 ||
> +			le32_to_cpu(desc->grpid) > ctrl->anagrpmax))
>  			return -EINVAL;
> -		if (WARN_ON_ONCE(le32_to_cpu(desc->grpid) > ctrl->anagrpmax))
> -			return -EINVAL;
> -		if (WARN_ON_ONCE(desc->state == 0))
> -			return -EINVAL;
> -		if (WARN_ON_ONCE(desc->state > NVME_ANA_CHANGE))
> +		if (WARN_ON_ONCE(desc->state == 0 ||
> +			desc->state > NVME_ANA_CHANGE))

So besides making the code impossibl to read due to the incorrect
indentation this also makes each WARN_ON_ONCE cover multiple conditions.
Not very useful for debugging.

  parent reply	other threads:[~2021-06-08  5:23 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-08  4:13 [PATCH] nvme-multipath: combine grpid and ANA state checks in nvme_parse_ana_log() Wu Bo
2021-06-08  4:13 ` Wu Bo
2021-06-08  4:55 ` Chaitanya Kulkarni
2021-06-08  4:55   ` Chaitanya Kulkarni
2021-06-08  5:23 ` Christoph Hellwig [this message]
2021-06-08  5:23   ` Christoph Hellwig
2021-06-08 12:30   ` Wu Bo
2021-06-08 12:30     ` Wu Bo
2021-06-08 12:32   ` Wu Bo
2021-06-08 12:32     ` Wu Bo

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=20210608052320.GA13828@lst.de \
    --to=hch@lst.de \
    --cc=axboe@fb.com \
    --cc=kbusch@kernel.org \
    --cc=linfeilong@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=sagi@grimberg.me \
    --cc=wubo40@huawei.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 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.