Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4055339pxj; Tue, 8 Jun 2021 05:33:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyR/J6vkAy/HYV625h3zM9h6yupIYmD+mqtbbVvwK3AqyDumSpzXjyaT7Hk4470KU1xeC6g X-Received: by 2002:a50:bf0f:: with SMTP id f15mr24748793edk.205.1623155599464; Tue, 08 Jun 2021 05:33:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623155599; cv=none; d=google.com; s=arc-20160816; b=GDso6JZoSC96Z09KtpVXyG4jTLdrQFSUGAAQZ8+9opU1//pSD65wVjpvq39V7C5npQ BVu0d2ziumsX/SabS2yUwurt+0UM07h+aoDtZlV8lQYHw+lauX66Kza27Ty2sx+lMpm6 ZUKUhW/gorWnsWtwzePrDvoWPFXiuvaIdru47MU3gkdkQcQIUdxmUWLTGhJ6+jFacGhq dDJnA6w8sAZE5hOwvTXvyg8W7fbMIVTKQd19QK8pJh+wCJty0ykY4EikVHgZRsisBN7b CaTKKCxqoO5d1oJx/G/ME3a4Ek8Uv0wF0Gr86r6ZaS6icOgd04Y2OPFjS0qIuR1U5kwu UycA== 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=1g6dWKVZdNyhtYeNLJlW1/CsqdnjyDUsQMKKH/C7Vh4=; b=f7sW+FR7YG3M0kPxldSllXEpB/18tHIYfDsqIBxl/LE65PHhnqGjCuUsBW5Hw5ATQ4 +f2w4N7LJI7XJX8hUgoSuEOyk12lePf9LzpWpAXW0fGfp72pgYvgvbMfda6rj9wTVxW7 NYJGl2jceWOnVSjVcODEiA3ilNb1IA2O8quTrkEDgD2xSIAbUnunc2LD/gVZWW8GdRB9 M7Ix+J/GjF24yQe6+mUQvbvsvEIVVrVUFcWqdugCCr/dlQfE803mNTlHuIZOvDA4f7zs uM92Txy6HuDMIJD6dO8W+SQiVf1olHf6t+DuOKGwcksc+Bf6vvpgcLE3Zwnglg3Khy0y 2VRQ== 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 v13si15856437ejk.187.2021.06.08.05.32.54; Tue, 08 Jun 2021 05:33:19 -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 S232575AbhFHMce (ORCPT + 99 others); Tue, 8 Jun 2021 08:32:34 -0400 Received: from szxga03-in.huawei.com ([45.249.212.189]:5334 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232614AbhFHMcY (ORCPT ); Tue, 8 Jun 2021 08:32:24 -0400 Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.57]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4FzqH36Ycpz6ttB; Tue, 8 Jun 2021 20:26:39 +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:30:29 +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:30:28 +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: <3a243d2c-f9b9-edcf-1762-9b08cf21f152@huawei.com> Date: Tue, 8 Jun 2021 20:30:14 +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: dggems705-chm.china.huawei.com (10.3.19.182) 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 >