[Devel] [PATCH RHEL9 COMMIT] dm-qcow2: fix warning about wrong printk format for size_t

Konstantin Khorenko khorenko at virtuozzo.com
Mon Mar 10 20:15:42 MSK 2025


The commit is pushed to "branch-rh9-5.14.0-427.44.1.vz9.80.x-ovz" and will appear at git at bitbucket.org:openvz/vzkernel.git
after rh9-5.14.0-427.44.1.vz9.80.19
------>
commit 2f6638650970b1fe73b0f737ca8d26a6fb67ab2e
Author: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
Date:   Wed Mar 5 19:45:22 2025 +0800

    dm-qcow2: fix warning about wrong printk format for size_t
    
      In file included from ./include/linux/kernel.h:20,
                       from ./include/linux/list.h:9,
                       from ./include/linux/preempt.h:12,
                       from ./include/linux/spinlock.h:56,
                       from drivers/md/dm-qcow2-map.c:5:
      drivers/md/dm-qcow2-map.c: In function ‘process_compressed_read’:
      ./include/linux/kern_levels.h:5:25: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ {aka ‘long unsigned int’} [-Wformat=]
          5 | #define KERN_SOH        "\001"          /* ASCII Start Of Header */
            |                         ^~~~~~
      ./include/linux/printk.h:497:25: note: in definition of macro ‘printk_index_wrap’
        497 |                 _p_func(_fmt, ##__VA_ARGS__);                           \
            |                         ^~~~
      ./include/linux/printk.h:568:9: note: in expansion of macro ‘printk’
        568 |         printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
            |         ^~~~~~
      ./include/linux/kern_levels.h:11:25: note: in expansion of macro ‘KERN_SOH’
         11 | #define KERN_ERR        KERN_SOH "3"    /* error conditions */
            |                         ^~~~~~~~
      ./include/linux/printk.h:568:16: note: in expansion of macro ‘KERN_ERR’
        568 |         printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
            |                ^~~~~~~~
      drivers/md/dm-qcow2.h:215:33: note: in expansion of macro ‘pr_err’
        215 | #define QC_ERR(dmti, fmt, ...)  pr_err (QCOW2_FMT(fmt),                 \
            |                                 ^~~~~~
      drivers/md/dm-qcow2-map.c:3691:41: note: in expansion of macro ‘QC_ERR’
       3691 |                                         QC_ERR(qcow2->tgt->ti,
            |                                         ^~~~~~
    
    While on it fix line wrap alignment.
    
    Fixes: f3662b758e84 ("dm-qcow2: fixup printk argument type")
    
    https://virtuozzo.atlassian.net/browse/VSTOR-100466
    Signed-off-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
    
    Feature: dm-qcow2: block device over QCOW2 files driver
    
    --
    v2: Rebase on top of vz9.80.19, "%lu" is also incorrect, see
    Documentation/core-api/printk-formats.rst.
---
 drivers/md/dm-qcow2-map.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/md/dm-qcow2-map.c b/drivers/md/dm-qcow2-map.c
index 7a1312a74e9f..f7cb036bb416 100644
--- a/drivers/md/dm-qcow2-map.c
+++ b/drivers/md/dm-qcow2-map.c
@@ -3689,8 +3689,8 @@ static void process_compressed_read(struct list_head *read_list,
 				buf = kvmalloc(qcow2->clu_size + dctxlen, GFP_NOIO);
 				if (!buf) {
 					QC_ERR(qcow2->tgt->ti,
-					       "can not allocate decompression buffer:%lu",
-						   qcow2->clu_size + dctxlen);
+					       "can not allocate decompression buffer:%zu",
+					       qcow2->clu_size + dctxlen);
 					end_qios(read_list, BLK_STS_RESOURCE);
 					return;
 				}


More information about the Devel mailing list