[PATCH] memblock: fix format strings for panics after memblock_alloc

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

 



Using "%lu" to print size_t variables causes build warnings on i386 and
probably other architectures:

kernel/dma/swiotlb.c:210:35: warning: format '%lu' expects argument of type
'long unsigned int', but argument 3 has type 'size_t' {aka 'unsigned int'}
[-Wformat=]
      panic("%s: Failed to allocate %lu bytes align=0x%lx\n",
                                    ~~^
                                    %u
            __func__, alloc_size, PAGE_SIZE);
                      ~~~~~~~~~~

Replace "%lu" with "%zu".

Signed-off-by: Mike Rapoport <rppt@xxxxxxxxxxxxx>
---

Andrew, can you please fold this into "treewide: add checks for the return
value of memblock_alloc*()"?

 arch/x86/platform/olpc/olpc_dt.c | 2 +-
 kernel/dma/swiotlb.c             | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/x86/platform/olpc/olpc_dt.c b/arch/x86/platform/olpc/olpc_dt.c
index dad3b60..ac9e7bf 100644
--- a/arch/x86/platform/olpc/olpc_dt.c
+++ b/arch/x86/platform/olpc/olpc_dt.c
@@ -142,7 +142,7 @@ void * __init prom_early_alloc(unsigned long size)
 		 */
 		res = memblock_alloc(chunk_size, SMP_CACHE_BYTES);
 		if (!res)
-			panic("%s: Failed to allocate %lu bytes\n", __func__,
+			panic("%s: Failed to allocate %zu bytes\n", __func__,
 			      chunk_size);
 		BUG_ON(!res);
 		prom_early_allocated += chunk_size;
diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c
index b64b500..ad33fee 100644
--- a/kernel/dma/swiotlb.c
+++ b/kernel/dma/swiotlb.c
@@ -207,13 +207,13 @@ int __init swiotlb_init_with_tbl(char *tlb, unsigned long nslabs, int verbose)
 	alloc_size = PAGE_ALIGN(io_tlb_nslabs * sizeof(int));
 	io_tlb_list = memblock_alloc(alloc_size, PAGE_SIZE);
 	if (!io_tlb_list)
-		panic("%s: Failed to allocate %lu bytes align=0x%lx\n",
+		panic("%s: Failed to allocate %zu bytes align=0x%lx\n",
 		      __func__, alloc_size, PAGE_SIZE);
 
 	alloc_size = PAGE_ALIGN(io_tlb_nslabs * sizeof(phys_addr_t));
 	io_tlb_orig_addr = memblock_alloc(alloc_size, PAGE_SIZE);
 	if (!io_tlb_orig_addr)
-		panic("%s: Failed to allocate %lu bytes align=0x%lx\n",
+		panic("%s: Failed to allocate %zu bytes align=0x%lx\n",
 		      __func__, alloc_size, PAGE_SIZE);
 
 	for (i = 0; i < io_tlb_nslabs; i++) {
-- 
2.7.4




[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