lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202304030354.XjyAhCHl-lkp@intel.com>
Date:   Mon, 3 Apr 2023 03:57:27 +0800
From:   kernel test robot <lkp@...el.com>
To:     MaĆ­ra Canal <maira.canal@....br>
Cc:     oe-kbuild-all@...ts.linux.dev, linux-kernel@...r.kernel.org,
        Javier Martinez Canillas <javierm@...hat.com>
Subject: drivers/gpu/drm/tests/drm_buddy_test.c:431:7: warning: Local
 variable 'order' shadows outer variable [shadowVariable]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   00c7b5f4ddc5b346df62b757ec73f9357bb452af
commit: 932da861956ac425ba4e65f7696458f96d833883 drm: selftest: convert drm_buddy selftest to KUnit
date:   9 months ago
compiler: arceb-elf-gcc (GCC) 12.1.0
reproduce (cppcheck warning):
        # apt-get install cppcheck
        git checkout 932da861956ac425ba4e65f7696458f96d833883
        cppcheck --quiet --enable=style,performance,portability --template=gcc FILE

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@...el.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202304030354.XjyAhCHl-lkp@intel.com/

cppcheck warnings: (new ones prefixed by >>)
>> drivers/gpu/drm/tests/drm_buddy_test.c:431:7: warning: Local variable 'order' shadows outer variable [shadowVariable]
     int order, err;
         ^
   drivers/gpu/drm/tests/drm_buddy_test.c:410:7: note: Shadowed declaration
    int *order;
         ^
   drivers/gpu/drm/tests/drm_buddy_test.c:431:7: note: Shadow variable
     int order, err;
         ^

vim +/order +431 drivers/gpu/drm/tests/drm_buddy_test.c

   404	
   405	static void igt_buddy_alloc_smoke(struct kunit *test)
   406	{
   407		u64 mm_size, chunk_size, start = 0;
   408		unsigned long flags = 0;
   409		struct drm_buddy mm;
   410		int *order;
   411		int i;
   412	
   413		DRM_RND_STATE(prng, random_seed);
   414		IGT_TIMEOUT(end_time);
   415	
   416		igt_mm_config(&mm_size, &chunk_size);
   417	
   418		KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_init(&mm, mm_size, chunk_size),
   419				       "buddy_init failed\n");
   420	
   421		order = drm_random_order(mm.max_order + 1, &prng);
   422		KUNIT_ASSERT_TRUE(test, order);
   423	
   424		for (i = 0; i <= mm.max_order; ++i) {
   425			struct drm_buddy_block *block;
   426			int max_order = order[i];
   427			bool timeout = false;
   428			LIST_HEAD(blocks);
   429			u64 total, size;
   430			LIST_HEAD(tmp);
 > 431			int order, err;
   432	
   433			KUNIT_ASSERT_FALSE_MSG(test, igt_check_mm(test, &mm),
   434					       "pre-mm check failed, abort\n");
   435	
   436			order = max_order;
   437			total = 0;
   438	
   439			do {
   440	retry:
   441				size = get_size(order, chunk_size);
   442				err = drm_buddy_alloc_blocks(&mm, start, mm_size, size, size, &tmp, flags);
   443				if (err) {
   444					if (err == -ENOMEM) {
   445						KUNIT_FAIL(test, "buddy_alloc hit -ENOMEM with order=%d\n",
   446							   order);
   447					} else {
   448						if (order--) {
   449							err = 0;
   450							goto retry;
   451						}
   452	
   453						KUNIT_FAIL(test, "buddy_alloc with order=%d failed\n",
   454							   order);
   455					}
   456	
   457					break;
   458				}
   459	
   460				block = list_first_entry_or_null(&tmp, struct drm_buddy_block, link);
   461				KUNIT_ASSERT_TRUE_MSG(test, block, "alloc_blocks has no blocks\n");
   462	
   463				list_move_tail(&block->link, &blocks);
   464				KUNIT_EXPECT_EQ_MSG(test, drm_buddy_block_order(block), order,
   465						    "buddy_alloc order mismatch\n");
   466	
   467				total += drm_buddy_block_size(&mm, block);
   468	
   469				if (__igt_timeout(end_time, NULL)) {
   470					timeout = true;
   471					break;
   472				}
   473			} while (total < mm.size);
   474	
   475			if (!err)
   476				err = igt_check_blocks(test, &mm, &blocks, total, false);
   477	
   478			drm_buddy_free_list(&mm, &blocks);
   479	
   480			if (!err) {
   481				KUNIT_EXPECT_FALSE_MSG(test, igt_check_mm(test, &mm),
   482						       "post-mm check failed\n");
   483			}
   484	
   485			if (err || timeout)
   486				break;
   487	
   488			cond_resched();
   489		}
   490	
   491		kfree(order);
   492		drm_buddy_fini(&mm);
   493	}
   494	

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ