From: Andrey Konovalov <andreyknvl@gmail.com>
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: "Liu, Yujie" <yujie.liu@intel.com>,
Andrew Morton <akpm@linux-foundation.org>,
kernel test robot <lkp@intel.com>,
Haibo Li <haibo.li@mediatek.com>,
linux-kernel@vger.kernel.org,
Andrey Ryabinin <ryabinin.a.a@gmail.com>,
Alexander Potapenko <glider@google.com>,
Dmitry Vyukov <dvyukov@google.com>,
Vincenzo Frascino <vincenzo.frascino@arm.com>,
Matthias Brugger <matthias.bgg@gmail.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
kasan-dev@googlegroups.com, linux-mm@kvack.org,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org, xiaoming.yu@mediatek.com
Subject: Re: [PATCH] fix comparison of unsigned expression < 0
Date: Wed, 13 Dec 2023 16:31:35 +0100 [thread overview]
Message-ID: <CA+fCnZc73qNqNiCMcKFKRuoBki=Bmhdw-mOY9chV=CjAtm0R+g@mail.gmail.com> (raw)
In-Reply-To: <ecf38b22-ee64-41e5-b9b5-c32fc1cb57bc@moroto.mountain>
On Mon, Dec 4, 2023 at 5:12 AM Dan Carpenter <dan.carpenter@linaro.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!
prev parent reply other threads:[~2023-12-13 15:31 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-28 7:55 Haibo Li
2023-11-29 1:22 ` Andrew Morton
2023-11-29 3:01 ` Andrey Konovalov
2023-11-29 3:42 ` Haibo Li
2023-12-04 4:12 ` Dan Carpenter
2023-12-13 15:31 ` Andrey Konovalov [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CA+fCnZc73qNqNiCMcKFKRuoBki=Bmhdw-mOY9chV=CjAtm0R+g@mail.gmail.com' \
--to=andreyknvl@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=angelogioacchino.delregno@collabora.com \
--cc=dan.carpenter@linaro.org \
--cc=dvyukov@google.com \
--cc=glider@google.com \
--cc=haibo.li@mediatek.com \
--cc=kasan-dev@googlegroups.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-mm@kvack.org \
--cc=lkp@intel.com \
--cc=matthias.bgg@gmail.com \
--cc=ryabinin.a.a@gmail.com \
--cc=vincenzo.frascino@arm.com \
--cc=xiaoming.yu@mediatek.com \
--cc=yujie.liu@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox