Skip to contentSkip to conversation

orangefs: bufmap: fix size_t format string

PATCH In review Arnd Bergmann 3 participants 3 messages Apr 13 Orangefs filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 orangefs: bufmap: fix size_t format string

From: Arnd Bergmann <[email protected]>

One of the printk() formats was accidentally changed from %zd to %ld, causing a build time warning on 32-bit targets:

In file included from fs/orangefs/orangefs-bufmap.c:7:
fs/orangefs/orangefs-bufmap.c: In function 'orangefs_bufmap_copy_to_iovec':
include/linux/kern_levels.h:5:25: error: format '%ld' expects argument of type 'long int', but argument 3 has type 'size_t' {aka 'unsigned int'} [-Werror=format=] fs/orangefs/orangefs-bufmap.c:759:29: note: in expansion of macro 'pr_info'
759 | if (size > 4194304) pr_info("%s: size:%ld\n", __func__, size);
| ^~~~~~~

Change this back to the correct version.

Fixes df6fd4485d7a ("bufmap: manage as folios.")
---
 fs/orangefs/orangefs-bufmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/orangefs/orangefs-bufmap.c +1 -1
index d476bd4df37c..122526f26b19 100644
@@ -756,7 +756,7 @@ int orangefs_bufmap_copy_to_iovec(struct iov_iter *iter,
 	from = &__orangefs_bufmap->desc_array[buffer_index];
 
 	/* shouldn't happen... */
-	if (size > 4194304) pr_info("%s: size:%ld\n", __func__, size);
+	if (size > 4194304) pr_info("%s: size:%zd\n", __func__, size);
 
 	gossip_debug(GOSSIP_BUFMAP_DEBUG,
 		"%s: buffer_index:%d size:%zu folio_count:%d\n",
Signature · 1 line
2.39.5
maintainer
#1 lore raw

Thanks Arnd...

I made a V2 of my patch, you suggested %zd, I used %zu which I think is OK too. I added some suggestions from Dan Williams to my V2 as well, I'll post the V2 version as soon as xfstests completes and I update my linux-next...

-Mike

Quoted 37 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

One of the printk() formats was accidentally changed from %zd to %ld, causing a build time warning on 32-bit targets:

In file included from fs/orangefs/orangefs-bufmap.c:7:
fs/orangefs/orangefs-bufmap.c: In function 'orangefs_bufmap_copy_to_iovec':
include/linux/kern_levels.h:5:25: error: format '%ld' expects argument of type 'long int', but argument 3 has type 'size_t' {aka 'unsigned int'} [-Werror=format=] fs/orangefs/orangefs-bufmap.c:759:29: note: in expansion of macro 'pr_info'
759 | if (size > 4194304) pr_info("%s: size:%ld\n", __func__, size);
| ^~~~~~~

Change this back to the correct version.

Fixes df6fd4485d7a ("bufmap: manage as folios.")
---
 fs/orangefs/orangefs-bufmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/orangefs/orangefs-bufmap.c +1 -2
index d476bd4df37c..122526f26b19 100644
@@ -756,7 +756,7 @@ int orangefs_bufmap_copy_to_iovec(struct iov_iter *iter,
        from = &__orangefs_bufmap->desc_array[buffer_index];
 
        /* shouldn't happen... */
-       if (size > 4194304) pr_info("%s: size:%ld\n", __func__, size);
+       if (size > 4194304) pr_info("%s: size:%zd\n", __func__, size);
 
        gossip_debug(GOSSIP_BUFMAP_DEBUG,
                "%s: buffer_index:%d size:%zu folio_count:%d\n",
--

2.39.5

#2 lore raw
Quoted 8 lines · Mike Marshall

Thanks Arnd...

I made a V2 of my patch, you suggested %zd, I used %zu which I think is OK too. I added some suggestions from Dan Williams to my V2 as well, I'll post the V2 version as soon as xfstests completes and I update my linux-next...

Sounds good, thanks!

Arnd