[linux-next:master 1570/2472] mm/kasan/init.c:318:9: warning: variable 'pud' set but not used

Linus Walleij linus.walleij at linaro.org
Mon Nov 2 19:17:35 EST 2020


On Mon, Nov 2, 2020 at 12:32 AM kernel test robot <lkp at intel.com> wrote:

>    mm/kasan/init.c: In function 'kasan_free_pud':
> >> mm/kasan/init.c:318:9: warning: variable 'pud' set but not used [-Wunused-but-set-variable]
>      318 |  pud_t *pud;
>          |         ^~~

So this is because
arch/arm/include/asm/pgtable-2level.h has:
#define pud_none(pud)           (0)
because of the way that PMDs are folded into the PUD.
(See the comment in the file.)

This is not liked by KASan because it looks like the pud
variable is unused.

Any suggestions? Should it be:
#define pud_none(pud)          (!pud_val(pud))
Like most other archs?

I also toyed with just putting __maybe_unused into the kasan init.

Any other ways to solve this?

Yours,
Linus Walleij



More information about the linux-arm-kernel mailing list