tree: git://git.cmpxchg.org/linux-mmotm.git master head: a4186de8d65ec2ca6c39070ef1d6795a0b4ffe04 commit: 143cfc886d8275787a78aca1b2aa6053a1f00d3c [293/305] treewide: 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 143cfc886d8275787a78aca1b2aa6053a1f00d3c # save the attached .config to linux build tree make ARCH=i386 All warnings (new ones prefixed by >>): arch/x86/platform/olpc/olpc_dt.c: In function 'prom_early_alloc': >> arch/x86/platform/olpc/olpc_dt.c:145:36: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'size_t' {aka 'const unsigned int'} [-Wformat=] panic("%s: Failed to allocate %lu bytes\n", __func__, ~~^ %u chunk_size); ~~~~~~~~~~ vim +145 arch/x86/platform/olpc/olpc_dt.c 127 128 void * __init prom_early_alloc(unsigned long size) 129 { 130 static u8 *mem; 131 static size_t free_mem; 132 void *res; 133 134 if (free_mem < size) { 135 const size_t chunk_size = max(PAGE_SIZE, size); 136 137 /* 138 * To mimimize the number of allocations, grab at least 139 * PAGE_SIZE of memory (that's an arbitrary choice that's 140 * fast enough on the platforms we care about while minimizing 141 * wasted bootmem) and hand off chunks of it to callers. 142 */ 143 res = memblock_alloc(chunk_size, SMP_CACHE_BYTES); 144 if (!res) > 145 panic("%s: Failed to allocate %lu bytes\n", __func__, 146 chunk_size); 147 BUG_ON(!res); 148 prom_early_allocated += chunk_size; 149 memset(res, 0, chunk_size); 150 free_mem = chunk_size; 151 mem = res; 152 } 153 154 /* allocate from the local cache */ 155 free_mem -= size; 156 res = mem; 157 mem += size; 158 return res; 159 } 160 --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
Attachment:
.config.gz
Description: application/gzip