[Devel] [PATCH VZ9 1/5] dm-qcow2: fix warning about wrong printk format for size_t

Pavel Tikhomirov ptikhomirov at virtuozzo.com
Fri Feb 28 07:21:04 MSK 2025


  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.

https://virtuozzo.atlassian.net/browse/VSTOR-100466
Signed-off-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
---
 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 5b695b6b281f1..f7cb036bb416e 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:%d",
-						   qcow2->clu_size + dctxlen);
+					       "can not allocate decompression buffer:%zu",
+					       qcow2->clu_size + dctxlen);
 					end_qios(read_list, BLK_STS_RESOURCE);
 					return;
 				}
-- 
2.48.1



More information about the Devel mailing list