Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4057961pxj; Tue, 8 Jun 2021 05:36:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxs+9dpLasKSsRaKvsc3ckAKBF1QkXllKFKRO22Wn9iwuGUgqQLIGD8f0CdYvuYdl8C7ruf X-Received: by 2002:a17:906:4f91:: with SMTP id o17mr23357415eju.219.1623155811888; Tue, 08 Jun 2021 05:36:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623155811; cv=none; d=google.com; s=arc-20160816; b=OiQSge1zXGDCHoJHTKo0I8Uv7S2eQ1chFxxrFoyi9Z4b3v+pJSUPgSlvuOT/BYR5/U 1PQaCPpDQC9PGzdieTvYJAY6OETp5Jznug0of3tPOM/vJ+bL83LuhOVUHs5gMd1nQw52 xcvxcFNSADZeNcd5e17uHEJG2AzayKq0P8+JIJxLy3uhOg2FW+J+WEmDxC/QzvsLShKc 8TLY1/HKdKv43u0dh/VOOeRyZ4UlkubcWMAHENjB1lesapNVLh5Q2WelEt8sfXS7ZB7P Vrz8yWB4I8LKXbYjdjHVhIaDkRo/mGO2fxSkFqcTKoG6mGzjEIh0G6nqUdG3op/Lwby6 opSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=FagTWd4lxtU+pGwtr712WVauiEMv9ojruCBRqV+EkjE=; b=xu0EEhr70zxAMzdBKPbhrazG7iOZpUfky2i6UbnDaBa6pIrJXGhKIzgTHoFtuuAFt4 Kvs8ie2/l4ADVgaV7KvFL4rWhGJ/QjiR/BtYPTSx4rXBUYcGMdeXkxEW2KfhSkR4OZAK Ywl0/piQ3iW3g0v76iv9FTHjiPqo0A8EWyynSoMhB8Ae+vjSzQLZDVGQrb8udA450r9H Yaua+baK83XiMTREG2/UroonAr8FzWgyLIR5bRZoFv3tq6fQ2i28WeP9mrPuUYmoRaaB 5XI3HfHE3LHFJGwrRS4jOmTr6XZbA3cbjh1l/W+8ArNmiWbSiDi9dRGnCPLAd+iY2GSP expw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c12si10299812edx.372.2021.06.08.05.36.28; Tue, 08 Jun 2021 05:36:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232607AbhFHMeN (ORCPT + 99 others); Tue, 8 Jun 2021 08:34:13 -0400 Received: from szxga03-in.huawei.com ([45.249.212.189]:5335 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232762AbhFHMeM (ORCPT ); Tue, 8 Jun 2021 08:34:12 -0400 Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.56]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4FzqK63sn7z6tsc; Tue, 8 Jun 2021 20:28:26 +0800 (CST) Received: from dggpeml500019.china.huawei.com (7.185.36.137) by dggemv704-chm.china.huawei.com (10.3.19.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Tue, 8 Jun 2021 20:32:16 +0800 Received: from [10.174.179.189] (10.174.179.189) by dggpeml500019.china.huawei.com (7.185.36.137) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Tue, 8 Jun 2021 20:32:16 +0800 Subject: Re: [PATCH] nvme-multipath: combine grpid and ANA state checks in nvme_parse_ana_log() To: Christoph Hellwig CC: , , , , , References: <1623125616-629270-1-git-send-email-wubo40@huawei.com> <20210608052320.GA13828@lst.de> From: Wu Bo Message-ID: <0f672080-671b-c1b8-18d5-3ddad90f53c4@huawei.com> Date: Tue, 8 Jun 2021 20:32:15 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.2.2 MIME-Version: 1.0 In-Reply-To: <20210608052320.GA13828@lst.de> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.179.189] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpeml500019.china.huawei.com (7.185.36.137) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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