All of lore.kernel.org
 help / color / mirror / Atom feed
* [bcache:for-next 9/19] drivers/md/bcache/nvm-pages.c:238:34: warning: Unsigned variable 'i' can't be negative so it is unnecessary to test it.
@ 2021-02-10 16:10 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2021-02-10 16:10 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 3638 bytes --]

CC: kbuild-all(a)lists.01.org
TO: Qiaowei Ren <qiaowei.ren@intel.com>
CC: Coly Li <colyli@suse.de>
CC: Jianpeng Ma <jianpeng.ma@intel.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/colyli/linux-bcache.git for-next
head:   78729af1b480ca5a3edb9547b97b59ed3dd72440
commit: 7719cf7684941455e7d6505d2554623a19b7184b [9/19] bcache: initialization of the buddy
:::::: branch date: 2 days ago
:::::: commit date: 2 days ago
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


cppcheck possible warnings: (new ones prefixed by >>, may not real problems)

   In file included from drivers/md/bcache/nvm-pages.c:
   drivers/md/bcache/nvm-pages.c:173:4: warning: Either the condition '!extents' is redundant or there is possible null pointer dereference: extents. [nullPointerRedundantCheck]
      extents->ns = only_set->nss[j];
      ^
   drivers/md/bcache/nvm-pages.c:185:10: note: Assuming that condition '!extents' is not redundant
        if (!extents) {
            ^
   drivers/md/bcache/nvm-pages.c:173:4: note: Null pointer dereference
      extents->ns = only_set->nss[j];
      ^
>> drivers/md/bcache/nvm-pages.c:238:34: warning: Unsigned variable 'i' can't be negative so it is unnecessary to test it. [unsignedPositive]
      for (i = BCH_MAX_ORDER - 1; i >= 0 ; i--) {
                                    ^

vim +238 drivers/md/bcache/nvm-pages.c

384227b99f4131 Qiaowei Ren 2021-02-08  225  
7719cf76849414 Qiaowei Ren 2021-02-08  226  static void init_nvm_free_space(struct bch_nvm_namespace *ns)
7719cf76849414 Qiaowei Ren 2021-02-08  227  {
7719cf76849414 Qiaowei Ren 2021-02-08  228  	unsigned int start, end, i;
7719cf76849414 Qiaowei Ren 2021-02-08  229  	struct page *page;
7719cf76849414 Qiaowei Ren 2021-02-08  230  	long long pages;
7719cf76849414 Qiaowei Ren 2021-02-08  231  	pgoff_t pgoff_start;
7719cf76849414 Qiaowei Ren 2021-02-08  232  
7719cf76849414 Qiaowei Ren 2021-02-08  233  	bitmap_for_each_clear_region(ns->pages_bitmap, start, end, 0, ns->pages_total) {
7719cf76849414 Qiaowei Ren 2021-02-08  234  		pgoff_start = start;
7719cf76849414 Qiaowei Ren 2021-02-08  235  		pages = end - start;
7719cf76849414 Qiaowei Ren 2021-02-08  236  
7719cf76849414 Qiaowei Ren 2021-02-08  237  		while (pages) {
7719cf76849414 Qiaowei Ren 2021-02-08 @238  			for (i = BCH_MAX_ORDER - 1; i >= 0 ; i--) {
7719cf76849414 Qiaowei Ren 2021-02-08  239  				if ((pgoff_start % (1 << i) == 0) && (pages >= (1 << i)))
7719cf76849414 Qiaowei Ren 2021-02-08  240  					break;
7719cf76849414 Qiaowei Ren 2021-02-08  241  			}
7719cf76849414 Qiaowei Ren 2021-02-08  242  
7719cf76849414 Qiaowei Ren 2021-02-08  243  			page = nvm_vaddr_to_page(ns, nvm_pgoff_to_vaddr(ns, pgoff_start));
7719cf76849414 Qiaowei Ren 2021-02-08  244  			page->index = pgoff_start;
7719cf76849414 Qiaowei Ren 2021-02-08  245  			set_page_private(page, i);
7719cf76849414 Qiaowei Ren 2021-02-08  246  			__SetPageBuddy(page);
7719cf76849414 Qiaowei Ren 2021-02-08  247  			list_add((struct list_head *)&page->zone_device_data, &ns->free_area[i]);
7719cf76849414 Qiaowei Ren 2021-02-08  248  
7719cf76849414 Qiaowei Ren 2021-02-08  249  			pgoff_start += 1 << i;
7719cf76849414 Qiaowei Ren 2021-02-08  250  			pages -= 1 << i;
7719cf76849414 Qiaowei Ren 2021-02-08  251  		}
7719cf76849414 Qiaowei Ren 2021-02-08  252  	}
7719cf76849414 Qiaowei Ren 2021-02-08  253  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-02-10 16:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-10 16:10 [bcache:for-next 9/19] drivers/md/bcache/nvm-pages.c:238:34: warning: Unsigned variable 'i' can't be negative so it is unnecessary to test it kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.