Re: [PATCH] mm/kmemleak: Avoid scanning potential huge holes
From: kernel test robot
Date: Sat Nov 06 2021 - 15:21:57 EST
Hi Lang,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on hnaz-mm/master]
url: https://github.com/0day-ci/linux/commits/Lang-Yu/mm-kmemleak-Avoid-scanning-potential-huge-holes/20211105-115425
base: https://github.com/hnaz/linux-mm master
config: xtensa-allyesconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 11.2.0
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/0day-ci/linux/commit/d455f236523de8c6b91774a74eb3163d2ff16e2e
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Lang-Yu/mm-kmemleak-Avoid-scanning-potential-huge-holes/20211105-115425
git checkout d455f236523de8c6b91774a74eb3163d2ff16e2e
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=xtensa
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>
All errors (new ones prefixed by >>):
mm/kmemleak.c: In function 'kmemleak_scan':
>> mm/kmemleak.c:1407:13: error: unused variable 'i' [-Werror=unused-variable]
1407 | int i;
| ^
cc1: all warnings being treated as errors
vim +/i +1407 mm/kmemleak.c
04609ccc40c4e8 Catalin Marinas 2009-10-28 1396
3c7b4e6b8be4c1 Catalin Marinas 2009-06-11 1397 /*
3c7b4e6b8be4c1 Catalin Marinas 2009-06-11 1398 * Scan data sections and all the referenced memory blocks allocated via the
3c7b4e6b8be4c1 Catalin Marinas 2009-06-11 1399 * kernel's standard allocators. This function must be called with the
3c7b4e6b8be4c1 Catalin Marinas 2009-06-11 1400 * scan_mutex held.
3c7b4e6b8be4c1 Catalin Marinas 2009-06-11 1401 */
3c7b4e6b8be4c1 Catalin Marinas 2009-06-11 1402 static void kmemleak_scan(void)
3c7b4e6b8be4c1 Catalin Marinas 2009-06-11 1403 {
3c7b4e6b8be4c1 Catalin Marinas 2009-06-11 1404 unsigned long flags;
04609ccc40c4e8 Catalin Marinas 2009-10-28 1405 struct kmemleak_object *object;
d455f236523de8 Lang Yu 2021-11-05 1406 struct zone *zone;
3c7b4e6b8be4c1 Catalin Marinas 2009-06-11 @1407 int i;
4698c1f2bbe44c Catalin Marinas 2009-06-26 1408 int new_leaks = 0;
3c7b4e6b8be4c1 Catalin Marinas 2009-06-11 1409
acf4968ec9dea4 Catalin Marinas 2009-06-26 1410 jiffies_last_scan = jiffies;
acf4968ec9dea4 Catalin Marinas 2009-06-26 1411
3c7b4e6b8be4c1 Catalin Marinas 2009-06-11 1412 /* prepare the kmemleak_object's */
3c7b4e6b8be4c1 Catalin Marinas 2009-06-11 1413 rcu_read_lock();
3c7b4e6b8be4c1 Catalin Marinas 2009-06-11 1414 list_for_each_entry_rcu(object, &object_list, object_list) {
8c96f1bc6fc49c He Zhe 2020-01-30 1415 raw_spin_lock_irqsave(&object->lock, flags);
3c7b4e6b8be4c1 Catalin Marinas 2009-06-11 1416 #ifdef DEBUG
3c7b4e6b8be4c1 Catalin Marinas 2009-06-11 1417 /*
3c7b4e6b8be4c1 Catalin Marinas 2009-06-11 1418 * With a few exceptions there should be a maximum of
3c7b4e6b8be4c1 Catalin Marinas 2009-06-11 1419 * 1 reference to any object at this point.
3c7b4e6b8be4c1 Catalin Marinas 2009-06-11 1420 */
3c7b4e6b8be4c1 Catalin Marinas 2009-06-11 1421 if (atomic_read(&object->use_count) > 1) {
ae281064be1643 Joe Perches 2009-06-23 1422 pr_debug("object->use_count = %d\n",
3c7b4e6b8be4c1 Catalin Marinas 2009-06-11 1423 atomic_read(&object->use_count));
3c7b4e6b8be4c1 Catalin Marinas 2009-06-11 1424 dump_object_info(object);
3c7b4e6b8be4c1 Catalin Marinas 2009-06-11 1425 }
3c7b4e6b8be4c1 Catalin Marinas 2009-06-11 1426 #endif
3c7b4e6b8be4c1 Catalin Marinas 2009-06-11 1427 /* reset the reference count (whiten the object) */
3c7b4e6b8be4c1 Catalin Marinas 2009-06-11 1428 object->count = 0;
3c7b4e6b8be4c1 Catalin Marinas 2009-06-11 1429 if (color_gray(object) && get_object(object))
3c7b4e6b8be4c1 Catalin Marinas 2009-06-11 1430 list_add_tail(&object->gray_list, &gray_list);
3c7b4e6b8be4c1 Catalin Marinas 2009-06-11 1431
8c96f1bc6fc49c He Zhe 2020-01-30 1432 raw_spin_unlock_irqrestore(&object->lock, flags);
3c7b4e6b8be4c1 Catalin Marinas 2009-06-11 1433 }
3c7b4e6b8be4c1 Catalin Marinas 2009-06-11 1434 rcu_read_unlock();
3c7b4e6b8be4c1 Catalin Marinas 2009-06-11 1435
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx
Attachment:
.config.gz
Description: application/gzip