lkml.org 
[lkml]   [2021]   [Jun]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] nvme-multipath: combine grpid and ANA state checks in nvme_parse_ana_log()
From
Date
On 2021/6/8 13:23, Christoph Hellwig wrote:
> 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.
> .
>

Indeed, not very useful for debugging, please ignore this patch.

Thanks,
Wu Bo

\
 
 \ /
  Last update: 2021-06-08 14:32    [W:0.040 / U:0.200 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site