Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3114131pxj; Mon, 10 May 2021 19:18:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy1pzP81PLgDLRRu9END26ZXCwosr9DFcG0NAjXAjCqoJhxsWbgNO67ORLhPs6pOaHBtLq/ X-Received: by 2002:a17:907:7629:: with SMTP id jy9mr29424517ejc.34.1620699497560; Mon, 10 May 2021 19:18:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620699497; cv=none; d=google.com; s=arc-20160816; b=lh5kR0MEJtOMpUdL2leOOPzgQPVcqXtWHJofIP24cxa6vhcN0bpSk+Y0iK/IxhNiEa 2+auYJgPwtd5aGFaTnz0qNwsusQ/JJmzZY01cVx2FJtXVTxXgt5xdrGmWWFLTTJB1e61 nn7zCKderMreXBhJ/OrP8XS4nRwVlU7z7wFC2CeLi25nYndnwSulqdUn/SDM519uBNgU PEBC6yXuKC2wrhitTOXhHuRt+XCAexnBMD51fo+MccD9+1pXKeR7zb/uh4W5kWPLInku 34fAowqiVSRSEt6p4ah4Wj6PdCr+IUTiHAp3pUYlCl32iN9ply/9kMSj6zZZ+M64Q4xH iUYg== 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=PFTc2i3kuFHab6nVge6wL83QDym4BdQNEYi8tePnbYE=; b=POhe3775SDSyEPktDxiwt8F+DkJ3BspLk8jgp5QIgRqQL0XF+u9ytR3nS2r+4Lwiph mzSa/z2q/XALVSCu5WCURkRsEU/pPfhJWh+7+XdUwAUSmIDnT14lDL+4mslMV+3IiTA3 H5TZZHfyAzPA2qXM83seSZIyDkgext70hhT3PA1/BmgiK5u7VpJPVksHIZckky+WRUG5 omwtr9nmWujnARlUZy509B/Y3IGBxLXIeN4y1aPvAXP7PODGYnjHhg5b/xG1e4HW/sUC iIk7nK42Viw86zvGcmGEA49OM33v0qKdVNiB8KaXVenYZ58Ab+cLelXaokf2IXM9p+EK KXnQ== 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=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d13si16272565ede.118.2021.05.10.19.17.53; Mon, 10 May 2021 19:18:17 -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=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230477AbhEKCRz (ORCPT + 99 others); Mon, 10 May 2021 22:17:55 -0400 Received: from out30-56.freemail.mail.aliyun.com ([115.124.30.56]:46707 "EHLO out30-56.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230398AbhEKCRy (ORCPT ); Mon, 10 May 2021 22:17:54 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R151e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04400;MF=joseph.qi@linux.alibaba.com;NM=1;PH=DS;RN=5;SR=0;TI=SMTPD_---0UYUn5Xl_1620699407; Received: from B-D1K7ML85-0059.local(mailfrom:joseph.qi@linux.alibaba.com fp:SMTPD_---0UYUn5Xl_1620699407) by smtp.aliyun-inc.com(127.0.0.1); Tue, 11 May 2021 10:16:48 +0800 Subject: Re: [Ocfs2-devel] [PATCH v2] ocfs2: Reomve err less than zero check To: Wengang Wang , Jiapeng Chong Cc: "linux-kernel@vger.kernel.org" , "ocfs2-devel@oss.oracle.com" , akpm References: <1620643062-124920-1-git-send-email-jiapeng.chong@linux.alibaba.com> <1EED85DE-EFE1-4FBA-9AA5-648D8E586DD9@oracle.com> From: Joseph Qi Message-ID: <2c9b7d34-01b9-d7de-2334-5d684d29d4eb@linux.alibaba.com> Date: Tue, 11 May 2021 10:16:47 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <1EED85DE-EFE1-4FBA-9AA5-648D8E586DD9@oracle.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/10/21 11:50 PM, Wengang Wang wrote: > Hi Jiapeng, > > Though the type of enum dlm_status has a value range starting from zero, It can be assigned with negative values without warnings. > I am wondering why you are sure it can’t be negative? You went over all the calling path and so you are sure it can’t be negative? > If you did that, I’d think/guess you should also be able to say it can’t be DLM_MAXSTATS or bigger, right? If not, which calling path are returning >= DLM_MAXSTATS value? > we should fix that too. > > I’d think we should treat the two conditions of (err >= DLM_MAXSTATS) and the (err < 0) the same way. If keep, keep both. if remove, remove both. > I’m suspecting the coccicheck warning is based on the type of enum (starting with 0), but if that’s the only theory to remove (err < 0), It’s NAK from me DLM_MAXSTATS is a valid value for dlm_status. Take a look again, I agree with Wengang that we'd better keep the check here for those misused return code. Thanks, Joseph