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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Nov 3, 2020 at 9:22 AM Ard Biesheuvel <ardb@xxxxxxxxxx> wrote:

> What about
>
> diff --git a/mm/kasan/init.c b/mm/kasan/init.c
> index fe6be0be1f76..7c3eb1f5a439 100644
> --- a/mm/kasan/init.c
> +++ b/mm/kasan/init.c
> @@ -315,12 +315,10 @@ static void kasan_free_pmd(pmd_t *pmd_start, pud_t *pud)
>
>  static void kasan_free_pud(pud_t *pud_start, p4d_t *p4d)
>  {
> -       pud_t *pud;
>         int i;
>
>         for (i = 0; i < PTRS_PER_PUD; i++) {
> -               pud = pud_start + i;
> -               if (!pud_none(*pud))
> +               if (!pud_none(pud_start[i]))
>                         return;
>         }

Yeah that is way better, also makes the code a lot easier to read.

I sent a patch rewriting all the kasan_free_p??() calls like this.

Yours,
Linus Walleij




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux