[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CA+fCnZc73qNqNiCMcKFKRuoBki=Bmhdw-mOY9chV=CjAtm0R+g@mail.gmail.com>
Date: Wed, 13 Dec 2023 16:31:35 +0100
From: Andrey Konovalov <andreyknvl@...il.com>
To: Dan Carpenter <dan.carpenter@...aro.org>
Cc: "Liu, Yujie" <yujie.liu@...el.com>,
Andrew Morton <akpm@...ux-foundation.org>,
kernel test robot <lkp@...el.com>,
Haibo Li <haibo.li@...iatek.com>, linux-kernel@...r.kernel.org,
Andrey Ryabinin <ryabinin.a.a@...il.com>,
Alexander Potapenko <glider@...gle.com>,
Dmitry Vyukov <dvyukov@...gle.com>,
Vincenzo Frascino <vincenzo.frascino@....com>,
Matthias Brugger <matthias.bgg@...il.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@...labora.com>,
kasan-dev@...glegroups.com, linux-mm@...ck.org,
linux-arm-kernel@...ts.infradead.org,
linux-mediatek@...ts.infradead.org, xiaoming.yu@...iatek.com
Subject: Re: [PATCH] fix comparison of unsigned expression < 0
On Mon, Dec 4, 2023 at 5:12 AM Dan Carpenter <dan.carpenter@...aro.org> wrote:
>
> > But I actually don't think we need to fix anything here.
> >
> > This issue looks quite close to a similar comparison with 0 issue
> > Linus shared his opinion on here:
> >
> > https://lore.kernel.org/all/Pine.LNX.4.58.0411230958260.20993@ppc970.osdl.org/
> >
> > I don't know if the common consensus with the regard to issues like
> > that changed since then. But if not, perhaps we can treat this kernel
> > test robot report as a false positive.
>
> I would say that the consensus has changed somewhere around 2015 or
> so. Unsigned comparisons to zero used to be one of the most common
> types of bugs in new code but now almost all subsystems have turned on
> the GCC warning for this.
>
> However, this is a Smatch warning and I agree with Linus on this. For
> example, Smatch doesn't complain about the example code the Linus
> mentioned.
>
> if (a < 0 || a > X)
>
> And in this case, it's a one liner fix for me to add KASAN_SHADOW_OFFSET
> as an allowed macro and silence the warning.
Hi Dan,
If this sounds like a good idea to you, please add an exception.
>From the KASAN side, I think adding an exception for this case makes sense.
Thank you!
Powered by blists - more mailing lists