x86: sparse warnings in pageattr.c

Adjust the definition of lookup_address to take an unsigned long
level argument. Adjust callers in xen/mmu.c that pass in a
dummy variable.

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

authored by

Harvey Harrison and committed by
Thomas Gleixner
da7bfc50 7c36752a

+9 -7
+5 -3
arch/x86/mm/pageattr.c
··· 191 191 * or when the present bit is not set. Otherwise we would return a 192 192 * pointer to a nonexisting mapping. 193 193 */ 194 - pte_t *lookup_address(unsigned long address, int *level) 194 + pte_t *lookup_address(unsigned long address, unsigned int *level) 195 195 { 196 196 pgd_t *pgd = pgd_offset_k(address); 197 197 pud_t *pud; ··· 255 255 unsigned long nextpage_addr, numpages, pmask, psize, flags; 256 256 pte_t new_pte, old_pte, *tmp; 257 257 pgprot_t old_prot, new_prot; 258 - int level, do_split = 1; 258 + int do_split = 1; 259 + unsigned int level; 259 260 260 261 spin_lock_irqsave(&pgd_lock, flags); 261 262 /* ··· 407 406 408 407 static int __change_page_attr(unsigned long address, struct cpa_data *cpa) 409 408 { 410 - int level, do_split, err; 409 + int do_split, err; 410 + unsigned int level; 411 411 struct page *kpte_page; 412 412 pte_t *kpte; 413 413
+3 -3
arch/x86/xen/mmu.c
··· 58 58 59 59 xmaddr_t arbitrary_virt_to_machine(unsigned long address) 60 60 { 61 - int level; 61 + unsigned int level; 62 62 pte_t *pte = lookup_address(address, &level); 63 63 unsigned offset = address & PAGE_MASK; 64 64 ··· 71 71 { 72 72 pte_t *pte, ptev; 73 73 unsigned long address = (unsigned long)vaddr; 74 - int level; 74 + unsigned int level; 75 75 76 76 pte = lookup_address(address, &level); 77 77 BUG_ON(pte == NULL); ··· 86 86 { 87 87 pte_t *pte, ptev; 88 88 unsigned long address = (unsigned long)vaddr; 89 - int level; 89 + unsigned int level; 90 90 91 91 pte = lookup_address(address, &level); 92 92 BUG_ON(pte == NULL);
+1 -1
include/asm-x86/pgtable.h
··· 255 255 * NOTE: the return type is pte_t but if the pmd is PSE then we return it 256 256 * as a pte too. 257 257 */ 258 - extern pte_t *lookup_address(unsigned long address, int *level); 258 + extern pte_t *lookup_address(unsigned long address, unsigned int *level); 259 259 260 260 /* local pte updates need not use xchg for locking */ 261 261 static inline pte_t native_local_ptep_get_and_clear(pte_t *ptep)