tree: git://git.cmpxchg.org/linux-mmotm.git master head: a4186de8d65ec2ca6c39070ef1d6795a0b4ffe04 commit: ed3a4b0e077d27416ac3f9bb37ee64e59f73b088 [292/305] swiotlb: add checks for the return value of memblock_alloc*() config: i386-allmodconfig (attached as .config) compiler: gcc-8 (Debian 8.2.0-14) 8.2.0 reproduce: git checkout ed3a4b0e077d27416ac3f9bb37ee64e59f73b088 # save the attached .config to linux build tree make ARCH=i386 All warnings (new ones prefixed by >>): kernel/dma/swiotlb.c: In function 'swiotlb_init_with_tbl': >> 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); ~~~~~~~~~~ kernel/dma/swiotlb.c:216: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); ~~~~~~~~~~ vim +210 kernel/dma/swiotlb.c 190 191 int __init swiotlb_init_with_tbl(char *tlb, unsigned long nslabs, int verbose) 192 { 193 unsigned long i, bytes; 194 size_t alloc_size; 195 196 bytes = nslabs << IO_TLB_SHIFT; 197 198 io_tlb_nslabs = nslabs; 199 io_tlb_start = __pa(tlb); 200 io_tlb_end = io_tlb_start + bytes; 201 202 /* 203 * Allocate and initialize the free list array. This array is used 204 * to find contiguous free memory regions of size up to IO_TLB_SEGSIZE 205 * between io_tlb_start and io_tlb_end. 206 */ 207 alloc_size = PAGE_ALIGN(io_tlb_nslabs * sizeof(int)); 208 io_tlb_list = memblock_alloc(alloc_size, PAGE_SIZE); 209 if (!io_tlb_list) > 210 panic("%s: Failed to allocate %lu bytes align=0x%lx\n", 211 __func__, alloc_size, PAGE_SIZE); 212 213 alloc_size = PAGE_ALIGN(io_tlb_nslabs * sizeof(phys_addr_t)); 214 io_tlb_orig_addr = memblock_alloc(alloc_size, PAGE_SIZE); 215 if (!io_tlb_orig_addr) 216 panic("%s: Failed to allocate %lu bytes align=0x%lx\n", 217 __func__, alloc_size, PAGE_SIZE); 218 219 for (i = 0; i < io_tlb_nslabs; i++) { 220 io_tlb_list[i] = IO_TLB_SEGSIZE - OFFSET(i, IO_TLB_SEGSIZE); 221 io_tlb_orig_addr[i] = INVALID_PHYS_ADDR; 222 } 223 io_tlb_index = 0; 224 225 if (verbose) 226 swiotlb_print_info(); 227 228 swiotlb_set_max_segment(io_tlb_nslabs << IO_TLB_SHIFT); 229 return 0; 230 } 231 --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
Attachment:
.config.gz
Description: application/gzip