[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <2c9b7d34-01b9-d7de-2334-5d684d29d4eb@linux.alibaba.com>
Date: Tue, 11 May 2021 10:16:47 +0800
From: Joseph Qi <joseph.qi@...ux.alibaba.com>
To: Wengang Wang <wen.gang.wang@...cle.com>,
Jiapeng Chong <jiapeng.chong@...ux.alibaba.com>
Cc: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"ocfs2-devel@....oracle.com" <ocfs2-devel@....oracle.com>,
akpm <akpm@...ux-foundation.org>
Subject: Re: [Ocfs2-devel] [PATCH v2] ocfs2: Reomve err less than zero check
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
Powered by blists - more mailing lists