tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master head: bcb67f0fbce97425c5fae5109ffc44c5ddaf96ba commit: 9b9607c0c01d45bbb0011bad9c6fefe4ab9df1d2 [6345/7161] ipc: do cyclic id allocation for the ipc object. config: m68k-amcore_defconfig (attached as .config) compiler: m68k-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0 reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross git checkout 9b9607c0c01d45bbb0011bad9c6fefe4ab9df1d2 # save the attached .config to linux build tree GCC_VERSION=7.2.0 make.cross ARCH=m68k All warnings (new ones prefixed by >>): In file included from include/asm-generic/bug.h:18:0, from arch/m68k/include/asm/bug.h:32, from include/linux/bug.h:5, from include/linux/mmdebug.h:5, from include/linux/mm.h:9, from ipc/util.c:47: ipc/util.c: In function 'ipc_idr_alloc': include/linux/kernel.h:828:29: warning: comparison of distinct pointer types lacks a cast (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1))) ^ include/linux/kernel.h:842:4: note: in expansion of macro '__typecheck' (__typecheck(x, y) && __no_side_effects(x, y)) ^~~~~~~~~~~ include/linux/kernel.h:852:24: note: in expansion of macro '__safe_cmp' __builtin_choose_expr(__safe_cmp(x, y), \ ^~~~~~~~~~ include/linux/kernel.h:868:19: note: in expansion of macro '__careful_cmp' #define max(x, y) __careful_cmp(x, y, >) ^~~~~~~~~~~~~ >> ipc/util.c:226:13: note: in expansion of macro 'max' max_idx = max(ids->in_use*3/2, ipc_min_cycle); ^~~ vim +/max +226 ipc/util.c 210 211 /* 212 * As soon as a new object is inserted into the idr, 213 * ipc_obtain_object_idr() or ipc_obtain_object_check() can find it, 214 * and the lockless preparations for ipc operations can start. 215 * This means especially: permission checks, audit calls, allocation 216 * of undo structures, ... 217 * 218 * Thus the object must be fully initialized, and if something fails, 219 * then the full tear-down sequence must be followed. 220 * (i.e.: set new->deleted, reduce refcount, call_rcu()) 221 */ 222 223 if (next_id < 0) { /* !CHECKPOINT_RESTORE or next_id is unset */ 224 int max_idx; 225 > 226 max_idx = max(ids->in_use*3/2, ipc_min_cycle); 227 max_idx = min(max_idx, ipc_mni); 228 229 /* allocate the idx, with a NULL struct kern_ipc_perm */ 230 idx = idr_alloc_cyclic(&ids->ipcs_idr, NULL, 0, max_idx, 231 GFP_NOWAIT); 232 233 if (idx >= 0) { 234 /* 235 * idx got allocated successfully. 236 * Now calculate the sequence number and set the 237 * pointer for real. 238 */ 239 if (idx <= ids->last_idx) { 240 ids->seq++; 241 if (ids->seq >= ipcid_seq_max()) 242 ids->seq = 0; 243 } 244 ids->last_idx = idx; 245 246 new->seq = ids->seq; 247 /* no need for smp_wmb(), this is done 248 * inside idr_replace, as part of 249 * rcu_assign_pointer 250 */ 251 idr_replace(&ids->ipcs_idr, new, idx); 252 } 253 } else { 254 new->seq = ipcid_to_seqx(next_id); 255 idx = idr_alloc(&ids->ipcs_idr, new, ipcid_to_idx(next_id), 256 0, GFP_NOWAIT); 257 } 258 if (idx >= 0) 259 new->id = (new->seq << ipcmni_seq_shift()) + idx; 260 return idx; 261 } 262 --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
Attachment:
.config.gz
Description: application/gzip