Re: [PATCH next resend 5/5] minmax: Relax check to allow comparison between int and small unsigned constants.

From: kernel test robot
Date: Fri Jul 28 2023 - 04:09:14 EST


Hi David,

kernel test robot noticed the following build warnings:

[auto build test WARNING on akpm-mm/mm-everything]
[also build test WARNING on linus/master crng-random/master v6.5-rc3 next-20230728]
[cannot apply to next-20230725]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/David-Laight/minmax-Allow-min-max-clamp-if-the-arguments-have-the-same-signedness/20230725-204940
base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
patch link: https://lore.kernel.org/r/48c2cd0407f14859919d4fcbe526234a%40AcuMS.aculab.com
patch subject: [PATCH next resend 5/5] minmax: Relax check to allow comparison between int and small unsigned constants.
config: xtensa-randconfig-r093-20230725 (https://download.01.org/0day-ci/archive/20230728/202307281556.iTVIR4tJ-lkp@xxxxxxxxx/config)
compiler: xtensa-linux-gcc (GCC) 12.3.0
reproduce: (https://download.01.org/0day-ci/archive/20230728/202307281556.iTVIR4tJ-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202307281556.iTVIR4tJ-lkp@xxxxxxxxx/

sparse warnings: (new ones prefixed by >>)
mm/kmemleak.c: note: in included file (through arch/xtensa/include/asm/bitops.h, include/linux/bitops.h, include/linux/kernel.h):
arch/xtensa/include/asm/processor.h:103:2: sparse: sparse: Unsupported xtensa ABI
arch/xtensa/include/asm/processor.h:133:2: sparse: sparse: Unsupported Xtensa ABI
>> mm/kmemleak.c:1429:32: sparse: sparse: incompatible types for operation (>=):
>> mm/kmemleak.c:1429:32: sparse: void *
>> mm/kmemleak.c:1429:32: sparse: int
>> mm/kmemleak.c:1429:32: sparse: sparse: bad constant expression type
>> mm/kmemleak.c:1429:32: sparse: sparse: incompatible types for operation (>=):
>> mm/kmemleak.c:1429:32: sparse: void *
>> mm/kmemleak.c:1429:32: sparse: int
>> mm/kmemleak.c:1429:32: sparse: sparse: incompatible types for operation (>=):
>> mm/kmemleak.c:1429:32: sparse: void *end
>> mm/kmemleak.c:1429:32: sparse: int
>> mm/kmemleak.c:1429:32: sparse: sparse: incompatible types for operation (>=):
>> mm/kmemleak.c:1429:32: sparse: void *
>> mm/kmemleak.c:1429:32: sparse: int
>> mm/kmemleak.c:1429:32: sparse: sparse: incompatible types for operation (>=):
>> mm/kmemleak.c:1429:32: sparse: void *end
>> mm/kmemleak.c:1429:32: sparse: int
mm/kmemleak.c:1429:32: sparse: sparse: incompatible types for operation (<):
mm/kmemleak.c:1429:32: sparse: bad type __UNIQUE_ID___x229
mm/kmemleak.c:1429:32: sparse: bad type __UNIQUE_ID___y230

vim +1429 mm/kmemleak.c

3c7b4e6b8be4c1 Catalin Marinas 2009-06-11 1396
3c7b4e6b8be4c1 Catalin Marinas 2009-06-11 1397 /*
3c7b4e6b8be4c1 Catalin Marinas 2009-06-11 1398 * Scan a memory block corresponding to a kmemleak_object. A condition is
3c7b4e6b8be4c1 Catalin Marinas 2009-06-11 1399 * that object->use_count >= 1.
3c7b4e6b8be4c1 Catalin Marinas 2009-06-11 1400 */
3c7b4e6b8be4c1 Catalin Marinas 2009-06-11 1401 static void scan_object(struct kmemleak_object *object)
3c7b4e6b8be4c1 Catalin Marinas 2009-06-11 1402 {
3c7b4e6b8be4c1 Catalin Marinas 2009-06-11 1403 struct kmemleak_scan_area *area;
3c7b4e6b8be4c1 Catalin Marinas 2009-06-11 1404 unsigned long flags;
0c24e061196c21 Patrick Wang 2022-06-11 1405 void *obj_ptr;
3c7b4e6b8be4c1 Catalin Marinas 2009-06-11 1406
3c7b4e6b8be4c1 Catalin Marinas 2009-06-11 1407 /*
21ae2956ce289f Uwe Kleine-König 2009-10-07 1408 * Once the object->lock is acquired, the corresponding memory block
21ae2956ce289f Uwe Kleine-König 2009-10-07 1409 * cannot be freed (the same lock is acquired in delete_object).
3c7b4e6b8be4c1 Catalin Marinas 2009-06-11 1410 */
8c96f1bc6fc49c He Zhe 2020-01-30 1411 raw_spin_lock_irqsave(&object->lock, flags);
3c7b4e6b8be4c1 Catalin Marinas 2009-06-11 1412 if (object->flags & OBJECT_NO_SCAN)
3c7b4e6b8be4c1 Catalin Marinas 2009-06-11 1413 goto out;
3c7b4e6b8be4c1 Catalin Marinas 2009-06-11 1414 if (!(object->flags & OBJECT_ALLOCATED))
3c7b4e6b8be4c1 Catalin Marinas 2009-06-11 1415 /* already freed object */
3c7b4e6b8be4c1 Catalin Marinas 2009-06-11 1416 goto out;
0c24e061196c21 Patrick Wang 2022-06-11 1417
0c24e061196c21 Patrick Wang 2022-06-11 1418 obj_ptr = object->flags & OBJECT_PHYS ?
0c24e061196c21 Patrick Wang 2022-06-11 1419 __va((phys_addr_t)object->pointer) :
0c24e061196c21 Patrick Wang 2022-06-11 1420 (void *)object->pointer;
0c24e061196c21 Patrick Wang 2022-06-11 1421
dba82d9431770e Catalin Marinas 2019-09-23 1422 if (hlist_empty(&object->area_list) ||
dba82d9431770e Catalin Marinas 2019-09-23 1423 object->flags & OBJECT_FULL_SCAN) {
0c24e061196c21 Patrick Wang 2022-06-11 1424 void *start = obj_ptr;
0c24e061196c21 Patrick Wang 2022-06-11 1425 void *end = obj_ptr + object->size;
93ada579b0eea0 Catalin Marinas 2015-06-24 1426 void *next;
af98603dad87e3 Catalin Marinas 2009-08-27 1427
93ada579b0eea0 Catalin Marinas 2015-06-24 1428 do {
93ada579b0eea0 Catalin Marinas 2015-06-24 @1429 next = min(start + MAX_SCAN_SIZE, end);
93ada579b0eea0 Catalin Marinas 2015-06-24 1430 scan_block(start, next, object);
93ada579b0eea0 Catalin Marinas 2015-06-24 1431
93ada579b0eea0 Catalin Marinas 2015-06-24 1432 start = next;
93ada579b0eea0 Catalin Marinas 2015-06-24 1433 if (start >= end)
93ada579b0eea0 Catalin Marinas 2015-06-24 1434 break;
af98603dad87e3 Catalin Marinas 2009-08-27 1435
8c96f1bc6fc49c He Zhe 2020-01-30 1436 raw_spin_unlock_irqrestore(&object->lock, flags);
af98603dad87e3 Catalin Marinas 2009-08-27 1437 cond_resched();
8c96f1bc6fc49c He Zhe 2020-01-30 1438 raw_spin_lock_irqsave(&object->lock, flags);
93ada579b0eea0 Catalin Marinas 2015-06-24 1439 } while (object->flags & OBJECT_ALLOCATED);
af98603dad87e3 Catalin Marinas 2009-08-27 1440 } else
b67bfe0d42cac5 Sasha Levin 2013-02-27 1441 hlist_for_each_entry(area, &object->area_list, node)
c017b4be3e8417 Catalin Marinas 2009-10-28 1442 scan_block((void *)area->start,
c017b4be3e8417 Catalin Marinas 2009-10-28 1443 (void *)(area->start + area->size),
93ada579b0eea0 Catalin Marinas 2015-06-24 1444 object);
3c7b4e6b8be4c1 Catalin Marinas 2009-06-11 1445 out:
8c96f1bc6fc49c He Zhe 2020-01-30 1446 raw_spin_unlock_irqrestore(&object->lock, flags);
3c7b4e6b8be4c1 Catalin Marinas 2009-06-11 1447 }
3c7b4e6b8be4c1 Catalin Marinas 2009-06-11 1448

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki