+ treewide-add-checks-for-the-return-value-of-memblock_alloc-fix.patch added to -mm tree

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

 



The patch titled
     Subject: mm: sparse: Use '%pa' with 'phys_addr_t' type
has been added to the -mm tree.  Its filename is
     treewide-add-checks-for-the-return-value-of-memblock_alloc-fix.patch

This patch should soon appear at
    http://ozlabs.org/~akpm/mmots/broken-out/treewide-add-checks-for-the-return-value-of-memblock_alloc-fix.patch
and later at
    http://ozlabs.org/~akpm/mmotm/broken-out/treewide-add-checks-for-the-return-value-of-memblock_alloc-fix.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: Anders Roxell <anders.roxell@xxxxxxxxxx>
Subject: mm: sparse: Use '%pa' with 'phys_addr_t' type

Fix the following build warning:

mm/sparse.c: In function `sparse_buffer_init':
mm/sparse.c:438:69: warning: format `%lx' expects argument of type `long
  unsigned int', but argument 6 has type `phys_addr_t' {aka `long long
  unsigned int'} [-Wformat=]
   panic("%s: Failed to allocate %lu bytes align=0x%lx nid=%d from=%lx
",
                                                                   ~~^

Rework to use '%pa' and not '%lx'. Use a local variable of phys_addr_t
to print the reference with '%pa'.

Link: http://lkml.kernel.org/r/20190131161046.21886-1-anders.roxell@xxxxxxxxxx
Fixes: 1c3c9328cde0 ("treewide: add checks for the return value of memblock_alloc*()")
Signed-off-by: Anders Roxell <anders.roxell@xxxxxxxxxx>
Cc: Mike Rapoport <rppt@xxxxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---


--- a/mm/sparse.c~treewide-add-checks-for-the-return-value-of-memblock_alloc-fix
+++ a/mm/sparse.c
@@ -411,16 +411,17 @@ struct page __init *sparse_mem_map_popul
 {
 	unsigned long size = section_map_size();
 	struct page *map = sparse_buffer_alloc(size);
+	phys_addr_t addr = __pa(MAX_DMA_ADDRESS);
 
 	if (map)
 		return map;
 
 	map = memblock_alloc_try_nid(size,
-					  PAGE_SIZE, __pa(MAX_DMA_ADDRESS),
+					  PAGE_SIZE, addr,
 					  MEMBLOCK_ALLOC_ACCESSIBLE, nid);
 	if (!map)
-		panic("%s: Failed to allocate %lu bytes align=0x%lx nid=%d from=%lx\n",
-		      __func__, size, PAGE_SIZE, nid, __pa(MAX_DMA_ADDRESS));
+		panic("%s: Failed to allocate %lu bytes align=0x%lx nid=%d from=%pa\n",
+		      __func__, size, PAGE_SIZE, nid, &addr);
 
 	return map;
 }
@@ -431,14 +432,15 @@ static void *sparsemap_buf_end __meminit
 
 static void __init sparse_buffer_init(unsigned long size, int nid)
 {
+	phys_addr_t addr = __pa(MAX_DMA_ADDRESS);
 	WARN_ON(sparsemap_buf);	/* forgot to call sparse_buffer_fini()? */
 	sparsemap_buf =
 		memblock_alloc_try_nid_raw(size, PAGE_SIZE,
-						__pa(MAX_DMA_ADDRESS),
+						addr,
 						MEMBLOCK_ALLOC_ACCESSIBLE, nid);
 	if (!sparsemap_buf)
-		panic("%s: Failed to allocate %lu bytes align=0x%lx nid=%d from=%lx\n",
-		      __func__, size, PAGE_SIZE, nid, __pa(MAX_DMA_ADDRESS));
+		panic("%s: Failed to allocate %lu bytes align=0x%lx nid=%d from=%pa\n",
+		      __func__, size, PAGE_SIZE, nid, &addr);
 
 	sparsemap_buf_end = sparsemap_buf + size;
 }
_

Patches currently in -mm which might be from anders.roxell@xxxxxxxxxx are

kasan-mark-file-common-so-ftrace-doesnt-trace-it.patch
lib-ubsan-default-ubsan_alignment-to-not-set.patch
treewide-add-checks-for-the-return-value-of-memblock_alloc-fix.patch




[Index of Archives]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux