[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 28 Nov 2023 17:22:38 -0800
From: Andrew Morton <akpm@...ux-foundation.org>
To: Haibo Li <haibo.li@...iatek.com>
Cc: <linux-kernel@...r.kernel.org>,
Andrey Ryabinin <ryabinin.a.a@...il.com>,
Alexander Potapenko <glider@...gle.com>,
Andrey Konovalov <andreyknvl@...il.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>,
kernel test robot <lkp@...el.com>
Subject: Re: [PATCH] fix comparison of unsigned expression < 0
On Tue, 28 Nov 2023 15:55:32 +0800 Haibo Li <haibo.li@...iatek.com> wrote:
> Kernel test robot reported:
>
> '''
> mm/kasan/report.c:637 kasan_non_canonical_hook() warn:
> unsigned 'addr' is never less than zero.
> '''
> The KASAN_SHADOW_OFFSET is 0 on loongarch64.
>
> To fix it,check the KASAN_SHADOW_OFFSET before do comparison.
>
> --- a/mm/kasan/report.c
> +++ b/mm/kasan/report.c
> @@ -634,10 +634,10 @@ void kasan_non_canonical_hook(unsigned long addr)
> {
> unsigned long orig_addr;
> const char *bug_type;
> -
> +#if KASAN_SHADOW_OFFSET > 0
> if (addr < KASAN_SHADOW_OFFSET)
> return;
> -
> +#endif
We'd rather not add ugly ifdefs for a simple test like this. If we
replace "<" with "<=", does it fix? I suspect that's wrong.
But really, some hardwired comparison with an absolute address seems
lazy. If KASAN_SHADOW_OFFSET is variable on a per-architecture basis
then the expression which checks the validity of an arbitrary address
should also be per-architecture.
Powered by blists - more mailing lists