Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1321156

[PATCH] um: asm/page.h: zero out a pte's high value in set_pte_val()

From Nicolai Stange <nicstange@gmail.com>
Newsgroups linux.kernel
Subject [PATCH] um: asm/page.h: zero out a pte's high value in set_pte_val()
Date 2016-01-29 01:00 +0100
Message-ID <qW4DM-2tl-1@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


Commit 16da306849d0 ("um: kill pfn_t")
introduced a compile warning for defconfig:

  arch/um/kernel/skas/mmu.c:38:206: warning: right shift count >= width of type
                                    [-Wshift-count-overflow]

Aforementioned patch changes the definition of the phys_to_pfn() macro from

  ((pfn_t) ((p) >> PAGE_SHIFT))

to

  ((p) >> PAGE_SHIFT)

This effectively changes the phys_to_pfn() expansion's type from
unsigned long long to unsigned long.

Through the callchain init_stub_pte()->mk_pte(), the expansion of
phys_to_pfn() is (indirectly) fed into the 'phys' argument of the
pte_set_val(pte, phys, prot) macro, eventually leading to

  (pte).pte_high = (phys) >> 32;

This results in the warning from above.

Since UML only deals with 32 bit addresses, the upper 32 bits from 'phys'
used to be zero anyway.

Zero out the pte value's high part in pte_set_val() in order to get rid
of the offending shift.

Fixes: 16da306849d0 ("um: kill pfn_t")
Signed-off-by: Nicolai Stange <nicstange@gmail.com>
---
 arch/um/include/asm/page.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/um/include/asm/page.h b/arch/um/include/asm/page.h
index e13d41c..61e235f 100644
--- a/arch/um/include/asm/page.h
+++ b/arch/um/include/asm/page.h
@@ -46,8 +46,8 @@ typedef struct { unsigned long pgd; } pgd_t;
 			      smp_wmb(); \
 			      (to).pte_low = (from).pte_low; })
 #define pte_is_zero(pte) (!((pte).pte_low & ~_PAGE_NEWPAGE) && !(pte).pte_high)
-#define pte_set_val(pte, phys, prot) \
-	({ (pte).pte_high = (phys) >> 32; \
+#define pte_set_val(pte, phys, prot)				\
+	({ (pte).pte_high = 0;					\
 	   (pte).pte_low = (phys) | pgprot_val(prot); })
 
 #define pmd_val(x)	((x).pmd)
-- 
2.7.0

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] um: asm/page.h: zero out a pte's high value in set_pte_val() Nicolai Stange <nicstange@gmail.com> - 2016-01-29 01:00 +0100
  Re: [PATCH] um: asm/page.h: zero out a pte's high value in  set_pte_val() Richard Weinberger <richard@nod.at> - 2016-01-29 01:50 +0100
    Re: [PATCH] um: asm/page.h: zero out a pte's high value in set_pte_val() Nicolai Stange <nicstange@gmail.com> - 2016-01-29 02:40 +0100
      Re: [PATCH] um: asm/page.h: zero out a pte's high value in  set_pte_val() Richard Weinberger <richard@nod.at> - 2016-01-29 09:50 +0100
        Re: [PATCH] um: asm/page.h: zero out a pte's high value in set_pte_val() Nicolai Stange <nicstange@gmail.com> - 2016-01-29 15:40 +0100
          Re: [PATCH] um: asm/page.h: zero out a pte's high value in  set_pte_val() Richard Weinberger <richard@nod.at> - 2016-01-31 10:20 +0100
            [PATCH v2] um: asm/page.h: remove the pte_high member from struct pte_t Nicolai Stange <nicstange@gmail.com> - 2016-01-31 16:10 +0100

csiph-web