[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20230616090054.b3lxtsj67oyp6s3h@bogus>
Date: Fri, 16 Jun 2023 10:00:54 +0100
From: Sudeep Holla <sudeep.holla@....com>
To: Conor Dooley <conor.dooley@...rochip.com>
Cc: 王明-软件底层技术部
<machel@...o.com>, Sudeep Holla <sudeep.holla@....com>,
Conor Dooley <conor@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"Rafael J. Wysocki" <rafael@...nel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"opensource.kernel" <opensource.kernel@...o.com>,
Pierre Gondois <pierre.gondois@....com>
Subject: Re: 回复: [PATCH v1]
drivers:base:Fix unsigned compared with less than zero
On Thu, Jun 15, 2023 at 07:50:45AM +0100, Conor Dooley wrote:
> Hey,
>
> For some (probably good) reason, this doesn't appear to have made it to
> the lists.
>
> On Thu, Jun 15, 2023 at 02:05:18AM +0000, 王明-软件底层技术部 wrote:
> > 发件人: Conor Dooley <conor@...nel.org>
> > > On Wed, Jun 14, 2023 at 09:35:36PM +0800, Wang Ming wrote:
> > > > The return value of the of_count_cache_leaves() is long.
> > > > However, the return value is being assigned to an unsigned long
> > > > variable 'leaves',so making 'leaves' to long.
> > >
> > > But you actually made it an int?
> > >
> > > > silence the warning:
> > > > ./drivers/base/cacheinfo.c:300:5-11: WARNING: Unsigned expression
> > > > compared with zero: leaves > 0
> > >
> > > I'm dumb, why is comparing an unsigned value with zero a problem in
> > > and of itself? Zero is a valid value for an unsigned type, no?
> > >
> > > If you actually look at the function, it only returns positive,
> > > non-zero values anyway, so returning an int is a bit pointless, as
> > > are the checks, no?
>
> > Thank you, I see. This doesn't need to be fixed.
>
> Right, but I was suggesting that you should change the function to not
> return a signed value anymore & remove the check for whether it is
> zero, instead of your patch.
>
> Cheers,
> Conor.
>
> +CC Sudeep, Pierre: FYI. Original posting is at
> https://lore.kernel.org/all/20230614133549.3774-1-machel@vivo.com/
> in case threading is broken, as I think the in-reply-to header in what
> I am replying to is corrupted.
Also if the original thread landed, I couldn't have responded because of
the disclaimer 🙁.
--
Regards,
Sudeep
Powered by blists - more mailing lists