linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [linux-next:master 8266/8290] arch/xtensa/mm/kasan_init.c:49:35: warning: format '%zu' expects argument of type 'size_t', but argument 3 has type 'long unsigned int'
@ 2019-02-14 23:26 kbuild test robot
  2019-02-15 18:49 ` Andrew Morton
  0 siblings, 1 reply; 2+ messages in thread
From: kbuild test robot @ 2019-02-14 23:26 UTC (permalink / raw)
  To: Mike Rapoport
  Cc: kbuild-all, Guo Ren, Juergen Gross, Geert Uytterhoeven,
	Andrew Morton, Linux Memory Management List

[-- Attachment #1: Type: text/plain, Size: 2614 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   c4f3ef3eb53fd7e8cbfe200d5ff6dba2b08526b5
commit: 5107c1e0490f01323cf3296f758271b06d9bb0f9 [8266/8290] treewide: add checks for the return value of memblock_alloc*()
config: xtensa-allyesconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 8.2.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 5107c1e0490f01323cf3296f758271b06d9bb0f9
        # save the attached .config to linux build tree
        GCC_VERSION=8.2.0 make.cross ARCH=xtensa 

All warnings (new ones prefixed by >>):

   arch/xtensa/mm/kasan_init.c: In function 'populate':
>> arch/xtensa/mm/kasan_init.c:49:35: warning: format '%zu' expects argument of type 'size_t', but argument 3 has type 'long unsigned int' [-Wformat=]
      panic("%s: Failed to allocate %zu bytes align=0x%lx\n",
                                    ~~^
                                    %lu
            __func__, n_pages * sizeof(pte_t), PAGE_SIZE);
                      ~~~~~~~~~~~~~~~~~~~~~~~

vim +49 arch/xtensa/mm/kasan_init.c

    37	
    38	static void __init populate(void *start, void *end)
    39	{
    40		unsigned long n_pages = (end - start) / PAGE_SIZE;
    41		unsigned long n_pmds = n_pages / PTRS_PER_PTE;
    42		unsigned long i, j;
    43		unsigned long vaddr = (unsigned long)start;
    44		pgd_t *pgd = pgd_offset_k(vaddr);
    45		pmd_t *pmd = pmd_offset(pgd, vaddr);
    46		pte_t *pte = memblock_alloc(n_pages * sizeof(pte_t), PAGE_SIZE);
    47	
    48		if (!pte)
  > 49			panic("%s: Failed to allocate %zu bytes align=0x%lx\n",
    50			      __func__, n_pages * sizeof(pte_t), PAGE_SIZE);
    51	
    52		pr_debug("%s: %p - %p\n", __func__, start, end);
    53	
    54		for (i = j = 0; i < n_pmds; ++i) {
    55			int k;
    56	
    57			for (k = 0; k < PTRS_PER_PTE; ++k, ++j) {
    58				phys_addr_t phys =
    59					memblock_phys_alloc(PAGE_SIZE, PAGE_SIZE);
    60	
    61				if (!phys)
    62					panic("Failed to allocate page table page\n");
    63	
    64				set_pte(pte + j, pfn_pte(PHYS_PFN(phys), PAGE_KERNEL));
    65			}
    66		}
    67	
    68		for (i = 0; i < n_pmds ; ++i, pte += PTRS_PER_PTE)
    69			set_pmd(pmd + i, __pmd((unsigned long)pte));
    70	
    71		local_flush_tlb_all();
    72		memset(start, 0, end - start);
    73	}
    74	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 56728 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [linux-next:master 8266/8290] arch/xtensa/mm/kasan_init.c:49:35: warning: format '%zu' expects argument of type 'size_t', but argument 3 has type 'long unsigned int'
  2019-02-14 23:26 [linux-next:master 8266/8290] arch/xtensa/mm/kasan_init.c:49:35: warning: format '%zu' expects argument of type 'size_t', but argument 3 has type 'long unsigned int' kbuild test robot
@ 2019-02-15 18:49 ` Andrew Morton
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2019-02-15 18:49 UTC (permalink / raw)
  To: kbuild test robot
  Cc: Mike Rapoport, kbuild-all, Guo Ren, Juergen Gross,
	Geert Uytterhoeven, Linux Memory Management List

On Fri, 15 Feb 2019 07:26:21 +0800 kbuild test robot <lkp@intel.com> wrote:

> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> head:   c4f3ef3eb53fd7e8cbfe200d5ff6dba2b08526b5
> commit: 5107c1e0490f01323cf3296f758271b06d9bb0f9 [8266/8290] treewide: add checks for the return value of memblock_alloc*()
> config: xtensa-allyesconfig (attached as .config)
> compiler: xtensa-linux-gcc (GCC) 8.2.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 5107c1e0490f01323cf3296f758271b06d9bb0f9
>         # save the attached .config to linux build tree
>         GCC_VERSION=8.2.0 make.cross ARCH=xtensa 
> 
> All warnings (new ones prefixed by >>):
> 
>    arch/xtensa/mm/kasan_init.c: In function 'populate':
> >> arch/xtensa/mm/kasan_init.c:49:35: warning: format '%zu' expects argument of type 'size_t', but argument 3 has type 'long unsigned int' [-Wformat=]
>       panic("%s: Failed to allocate %zu bytes align=0x%lx\n",
>                                     ~~^
>                                     %lu
>             __func__, n_pages * sizeof(pte_t), PAGE_SIZE);
>                       ~~~~~~~~~~~~~~~~~~~~~~~

OK, thanks.  UL * size_t = UL.

--- a/arch/xtensa/mm/kasan_init.c~treewide-add-checks-for-the-return-value-of-memblock_alloc-fix-3-fix
+++ a/arch/xtensa/mm/kasan_init.c
@@ -46,7 +46,7 @@ static void __init populate(void *start,
 	pte_t *pte = memblock_alloc(n_pages * sizeof(pte_t), PAGE_SIZE);
 
 	if (!pte)
-		panic("%s: Failed to allocate %zu bytes align=0x%lx\n",
+		panic("%s: Failed to allocate %lu bytes align=0x%lx\n",
 		      __func__, n_pages * sizeof(pte_t), PAGE_SIZE);
 
 	pr_debug("%s: %p - %p\n", __func__, start, end);
_


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-02-15 18:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-14 23:26 [linux-next:master 8266/8290] arch/xtensa/mm/kasan_init.c:49:35: warning: format '%zu' expects argument of type 'size_t', but argument 3 has type 'long unsigned int' kbuild test robot
2019-02-15 18:49 ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox