[intel-tdx:guest 99/136] kernel/dma/swiotlb.c:223:19: warning: format specifies type 'size_t' (aka 'unsigned int') but the argument has type 'unsigned long'

From: kernel test robot
Date: Sat Oct 09 2021 - 04:23:52 EST


tree: https://github.com/intel/tdx.git guest
head: 69f7bdc840a2e478fb51fab56121839c7886e2db
commit: 79f9e3e7c5e0554f2fd75addf7b3058099b7afee [99/136] swiotlb: use bitmap to track free slots
config: i386-randconfig-r015-20211009 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 30caca39f401ae17927439c0a0bd6d1b1916dd6a)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel/tdx/commit/79f9e3e7c5e0554f2fd75addf7b3058099b7afee
git remote add intel-tdx https://github.com/intel/tdx.git
git fetch --no-tags intel-tdx guest
git checkout 79f9e3e7c5e0554f2fd75addf7b3058099b7afee
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=i386

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

>> kernel/dma/swiotlb.c:223:19: warning: format specifies type 'size_t' (aka 'unsigned int') but the argument has type 'unsigned long' [-Wformat]
__func__, DIV_ROUND_UP(nslabs, BITS_PER_BYTE), SMP_CACHE_BYTES);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/math.h:36:22: note: expanded from macro 'DIV_ROUND_UP'
#define DIV_ROUND_UP __KERNEL_DIV_ROUND_UP
^
include/uapi/linux/const.h:34:37: note: expanded from macro '__KERNEL_DIV_ROUND_UP'
#define __KERNEL_DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
^~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.


vim +223 kernel/dma/swiotlb.c

201
202 int __init swiotlb_init_with_tbl(char *tlb, unsigned long nslabs, int verbose)
203 {
204 struct io_tlb_mem *mem = &io_tlb_default_mem;
205 size_t alloc_size;
206
207 if (swiotlb_force == SWIOTLB_NO_FORCE)
208 return 0;
209
210 /* protect against double initialization */
211 if (WARN_ON_ONCE(mem->nslabs))
212 return -ENOMEM;
213
214 alloc_size = PAGE_ALIGN(array_size(sizeof(*mem->slots), nslabs));
215 mem->slots = memblock_alloc(alloc_size, PAGE_SIZE);
216 if (!mem->slots)
217 panic("%s: Failed to allocate %zu bytes align=0x%lx\n",
218 __func__, alloc_size, PAGE_SIZE);
219
220 mem->bitmap = memblock_alloc(DIV_ROUND_UP(nslabs, BITS_PER_BYTE), SMP_CACHE_BYTES);
221 if (!mem->bitmap)
222 panic("%s: Failed to allocate %zu bytes align=0x%x\n",
> 223 __func__, DIV_ROUND_UP(nslabs, BITS_PER_BYTE), SMP_CACHE_BYTES);
224
225 swiotlb_init_io_tlb_mem(mem, __pa(tlb), nslabs, false);
226
227 if (verbose)
228 swiotlb_print_info();
229 swiotlb_set_max_segment(mem->nslabs << IO_TLB_SHIFT);
230 return 0;
231 }
232

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip