* [PATCH] memblock: fix format strings for panics after memblock_alloc
@ 2019-01-31 16:09 Mike Rapoport
0 siblings, 0 replies; only message in thread
From: Mike Rapoport @ 2019-01-31 16:09 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-mm, Mike Rapoport
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@linux.ibm.com>
---
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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2019-01-31 16:09 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-01-31 16:09 [PATCH] memblock: fix format strings for panics after memblock_alloc Mike Rapoport
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).