Re: [linux-next:master 10668/10701] include/linux/pgtable.h:203:2: note: in expansion of macro 'pte_clear'

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

 



On Thu, May 21, 2020 at 11:10:13AM -0700, Andrew Morton wrote:
> On Thu, 21 May 2020 17:30:52 +0800 kbuild test robot <lkp@xxxxxxxxx> wrote:
> 
> > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> > head:   fb57b1fabcb28f358901b2df90abd2b48abc1ca8
> > commit: ef03574dee21524cbdbbf2af29fe06a62610570d [10668/10701] mm: introduce include/linux/pgtable.h
> > config: parisc-randconfig-r011-20200521 (attached as .config)
> > compiler: hppa-linux-gcc (GCC) 9.3.0
> > reproduce:
> >         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> >         chmod +x ~/bin/make.cross
> >         git checkout ef03574dee21524cbdbbf2af29fe06a62610570d
> >         # save the attached .config to linux build tree
> >         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=parisc 
> > 
> > If you fix the issue, kindly add following tag as appropriate
> > Reported-by: kbuild test robot <lkp@xxxxxxxxx>
> > 
> > All warnings (new ones prefixed by >>, old ones prefixed by <<):
> > 
> > In file included from include/linux/pgtable.h:6,
> > from include/linux/mm.h:95,
> > from include/linux/pid_namespace.h:7,
> > from include/linux/ptrace.h:10,
> > from arch/parisc/kernel/asm-offsets.c:20:
> > include/linux/pgtable.h: In function 'pte_clear_not_present_full':
> > arch/parisc/include/asm/pgtable.h:96:9: warning: variable 'old_pte' set but not used [-Wunused-but-set-variable]
> > 96 |   pte_t old_pte;              |         ^~~~~~~
> > arch/parisc/include/asm/pgtable.h:322:34: note: in expansion of macro 'set_pte_at'
> > 322 | #define pte_clear(mm, addr, xp)  set_pte_at(mm, addr, xp, __pte(0))
> > |                                  ^~~~~~~~~~
> > >> include/linux/pgtable.h:203:2: note: in expansion of macro 'pte_clear'
> > 203 |  pte_clear(mm, address, ptep);
> > |  ^~~~~~~~~
> > include/linux/pgtable.h: In function '__ptep_modify_prot_commit':
> > arch/parisc/include/asm/pgtable.h:96:9: warning: variable 'old_pte' set but not used [-Wunused-but-set-variable]
> 
> I can't reproduce this.  And I can't see anything in -mm whcih would
> have triggered this warning.
> 
> arch/parisc/include/asm/pgtable.h has
> 
> #define set_pte_at(mm, addr, ptep, pteval)			\
> 	do {							\
> 		pte_t old_pte;					\
> 		unsigned long flags;				\
> 		spin_lock_irqsave(pgd_spinlock((mm)->pgd), flags);\
> 		old_pte = *ptep;				\
> 		set_pte(ptep, pteval);				\
> 		purge_tlb_entries(mm, addr);			\
> 		spin_unlock_irqrestore(pgd_spinlock((mm)->pgd), flags);\
> 	} while (0)
> 
> and old_pte has been set-but-not-used for a long time.
> 
> Obviously we can fix it, but I'm worried that parisc's set_pte_at() was
> previously unused and we've now done something to cause it to be used,
> so we're now running previously untested code.
 
I can reporduce it with

make W=1 ARCH=parisc CROSS_COMPILE=/opt/gcc-8.1.0-nolibc/hppa-linux/bin/hppa-linux-

on both the v5.7-rc6 and linux-next.

The only difference in the header names:

--- build-master.log	2020-05-21 21:44:03.064168815 +0300
+++ build-next.log	2020-05-21 21:44:52.372330747 +0300
@@ -2,25 +2,26 @@
   GEN     Makefile
   CALL    scripts/atomic/check-atomics.sh
   CC      arch/parisc/kernel/asm-offsets.s
-In file included from include/linux/mm.h:95,
+In file included from include/linux/pgtable.h:6,
+                 from include/linux/mm.h:31,
                  from include/linux/pid_namespace.h:7,
                  from include/linux/ptrace.h:10,
                  from arch/parisc/kernel/asm-offsets.c:20:
-include/asm-generic/pgtable.h: In function 'pte_clear_not_present_full':
+include/linux/pgtable.h: In function 'pte_clear_not_present_full':
 arch/parisc/include/asm/pgtable.h:96:9: warning: variable 'old_pte' set but not used [-Wunused-but-set-variable]
    pte_t old_pte;     \
          ^~~~~~~
 arch/parisc/include/asm/pgtable.h:322:34: note: in expansion of macro 'set_pte_at'
  #define pte_clear(mm, addr, xp)  set_pte_at(mm, addr, xp, __pte(0))
                                   ^~~~~~~~~~
...

I think moving asm-generic/pgtable.h to linux/pgtable.h triggered the
"new warning" notification.

And the fix is obviously:

>From 6de5f02d11fef8894836168c3e7bede05916d02d Mon Sep 17 00:00:00 2001
From: Mike Rapoport <rppt@xxxxxxxxxxxxx>
Date: Thu, 21 May 2020 21:49:01 +0300
Subject: [PATCH] parisc: set_pte_at: remove unused old_pte variable.

kbuild test robot complains about unused variable old_pte in set_pte_at()
macro:

arch/parisc/include/asm/pgtable.h:96:9: warning: variable 'old_pte' set but not used [-Wunused-but-set-variable]
96 |   pte_t old_pte;              |         ^~~~~~~
arch/parisc/include/asm/pgtable.h:322:34: note: in expansion of macro 'set_pte_at'
322 | #define pte_clear(mm, addr, xp)  set_pte_at(mm, addr, xp, __pte(0))

Remove the old_pte variable.

Reported-by: kbuild test robot <lkp@xxxxxxxxx>
Signed-off-by: Mike Rapoport <rppt@xxxxxxxxxxxxx>
---
 arch/parisc/include/asm/pgtable.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/arch/parisc/include/asm/pgtable.h b/arch/parisc/include/asm/pgtable.h
index 097d19007f2e..75cf84070fc9 100644
--- a/arch/parisc/include/asm/pgtable.h
+++ b/arch/parisc/include/asm/pgtable.h
@@ -93,10 +93,8 @@ static inline void purge_tlb_entries(struct mm_struct *mm, unsigned long addr)
 
 #define set_pte_at(mm, addr, ptep, pteval)			\
 	do {							\
-		pte_t old_pte;					\
 		unsigned long flags;				\
 		spin_lock_irqsave(pgd_spinlock((mm)->pgd), flags);\
-		old_pte = *ptep;				\
 		set_pte(ptep, pteval);				\
 		purge_tlb_entries(mm, addr);			\
 		spin_unlock_irqrestore(pgd_spinlock((mm)->pgd), flags);\
-- 
2.26.2


-- 
Sincerely yours,
Mike.




[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