From: Ard Biesheuvel <ardb@kernel.org>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: kernel test robot <lkp@intel.com>,
kbuild-all@lists.01.org,
Linux Memory Management List <linux-mm@kvack.org>,
Russell King <rmk+kernel@armlinux.org.uk>,
Abbott Liu <liuwenliang@huawei.com>,
Florian Fainelli <f.fainelli@gmail.com>,
Linux ARM <linux-arm-kernel@lists.infradead.org>
Subject: Re: [linux-next:master 1570/2472] mm/kasan/init.c:318:9: warning: variable 'pud' set but not used
Date: Tue, 3 Nov 2020 09:22:16 +0100 [thread overview]
Message-ID: <CAMj1kXG7uuXmyeDd4Fhfz9HP9APJzgBi_fdgpP4xaL4ObBJ_dA@mail.gmail.com> (raw)
In-Reply-To: <CACRpkdZWS6UbCr-2+7F-BZQZOgjSzxjhyDTOW0vfm3Z3B5ys=g@mail.gmail.com>
On Tue, 3 Nov 2020 at 01:17, Linus Walleij <linus.walleij@linaro.org> wrote:
>
> On Mon, Nov 2, 2020 at 12:32 AM kernel test robot <lkp@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?
>
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;
}
next prev parent reply other threads:[~2020-11-03 8:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-01 23:31 [linux-next:master 1570/2472] mm/kasan/init.c:318:9: warning: variable 'pud' set but not used kernel test robot
2020-11-03 0:17 ` Linus Walleij
2020-11-03 8:22 ` Ard Biesheuvel [this message]
2020-11-06 8:53 ` Linus Walleij
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=CAMj1kXG7uuXmyeDd4Fhfz9HP9APJzgBi_fdgpP4xaL4ObBJ_dA@mail.gmail.com \
--to=ardb@kernel.org \
--cc=f.fainelli@gmail.com \
--cc=kbuild-all@lists.01.org \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-mm@kvack.org \
--cc=liuwenliang@huawei.com \
--cc=lkp@intel.com \
--cc=rmk+kernel@armlinux.org.uk \
/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;
as well as URLs for NNTP newsgroup(s).