All of lore.kernel.org
 help / color / mirror / Atom feed
* [block:for-5.13/drivers 46/61] drivers/md/bcache/nvm-pages.c:156:34: warning: Unsigned variable 'i' can't be negative so it is unnecessary to test it. [unsignedPositive]
@ 2021-04-20  8:10 ` Dan Carpenter
  0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2021-04-20  8:10 UTC (permalink / raw)
  To: kbuild

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

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git  for-5.13/drivers
head:   b09729cbbbf28ecdc61f00335684f7566eb740ec
commit: 97c62b647fcabd86fe703f9869be7dd91e685f50 [46/61] bcache: initialization of the buddy
compiler: microblaze-linux-gcc (GCC) 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)

>> drivers/md/bcache/nvm-pages.c:156: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 +156 drivers/md/bcache/nvm-pages.c

97c62b647fcabd Jianpeng Ma 2021-04-14  144  static void init_nvm_free_space(struct bch_nvm_namespace *ns)
97c62b647fcabd Jianpeng Ma 2021-04-14  145  {
97c62b647fcabd Jianpeng Ma 2021-04-14  146  	unsigned int start, end, i;
                                                ^^^^^^^^^^^^             ^

97c62b647fcabd Jianpeng Ma 2021-04-14  147  	struct page *page;
97c62b647fcabd Jianpeng Ma 2021-04-14  148  	long long pages;
97c62b647fcabd Jianpeng Ma 2021-04-14  149  	pgoff_t pgoff_start;
97c62b647fcabd Jianpeng Ma 2021-04-14  150  
97c62b647fcabd Jianpeng Ma 2021-04-14  151  	bitmap_for_each_clear_region(ns->pages_bitmap, start, end, 0, ns->pages_total) {
97c62b647fcabd Jianpeng Ma 2021-04-14  152  		pgoff_start = start;
97c62b647fcabd Jianpeng Ma 2021-04-14  153  		pages = end - start;
97c62b647fcabd Jianpeng Ma 2021-04-14  154  
97c62b647fcabd Jianpeng Ma 2021-04-14  155  		while (pages) {
97c62b647fcabd Jianpeng Ma 2021-04-14 @156  			for (i = BCH_MAX_ORDER - 1; i >= 0 ; i--) {
                                                                                            ^^^^^^
This needs to be "int i;" for the loop to work correctly.

97c62b647fcabd Jianpeng Ma 2021-04-14  157  				if ((pgoff_start % (1 << i) == 0) && (pages >= (1 << i)))
97c62b647fcabd Jianpeng Ma 2021-04-14  158  					break;
97c62b647fcabd Jianpeng Ma 2021-04-14  159  			}
97c62b647fcabd Jianpeng Ma 2021-04-14  160  
97c62b647fcabd Jianpeng Ma 2021-04-14  161  			page = nvm_vaddr_to_page(ns, nvm_pgoff_to_vaddr(ns, pgoff_start));
97c62b647fcabd Jianpeng Ma 2021-04-14  162  			page->index = pgoff_start;
97c62b647fcabd Jianpeng Ma 2021-04-14  163  			set_page_private(page, i);
97c62b647fcabd Jianpeng Ma 2021-04-14  164  			__SetPageBuddy(page);
97c62b647fcabd Jianpeng Ma 2021-04-14  165  			list_add((struct list_head *)&page->zone_device_data, &ns->free_area[i]);
97c62b647fcabd Jianpeng Ma 2021-04-14  166  
97c62b647fcabd Jianpeng Ma 2021-04-14  167  			pgoff_start += 1 << i;
97c62b647fcabd Jianpeng Ma 2021-04-14  168  			pages -= 1 << i;
97c62b647fcabd Jianpeng Ma 2021-04-14  169  		}
97c62b647fcabd Jianpeng Ma 2021-04-14  170  	}
688330711e9ae3 Jianpeng Ma 2021-04-14  171  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org 
_______________________________________________
kbuild mailing list -- kbuild(a)lists.01.org
To unsubscribe send an email to kbuild-leave@lists.01.org

^ permalink raw reply	[flat|nested] 6+ messages in thread
* [block:for-5.13/drivers 46/61] drivers/md/bcache/nvm-pages.c:156:34: warning: Unsigned variable 'i' can't be negative so it is unnecessary to test it. [unsignedPositive]
@ 2021-04-16 16:58 kernel test robot
  0 siblings, 0 replies; 6+ messages in thread
From: kernel test robot @ 2021-04-16 16:58 UTC (permalink / raw)
  To: kbuild

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

CC: kbuild-all(a)lists.01.org
TO: Jianpeng Ma <jianpeng.ma@intel.com>
CC: Jens Axboe <axboe@kernel.dk>
CC: Coly Li <colyli@suse.de>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git for-5.13/drivers
head:   b09729cbbbf28ecdc61f00335684f7566eb740ec
commit: 97c62b647fcabd86fe703f9869be7dd91e685f50 [46/61] bcache: initialization of the buddy
:::::: branch date: 4 hours ago
:::::: commit date: 5 hours ago
compiler: microblaze-linux-gcc (GCC) 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)

>> drivers/md/bcache/nvm-pages.c:156: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 +156 drivers/md/bcache/nvm-pages.c

97c62b647fcabd Jianpeng Ma 2021-04-14  143  
97c62b647fcabd Jianpeng Ma 2021-04-14  144  static void init_nvm_free_space(struct bch_nvm_namespace *ns)
97c62b647fcabd Jianpeng Ma 2021-04-14  145  {
97c62b647fcabd Jianpeng Ma 2021-04-14  146  	unsigned int start, end, i;
97c62b647fcabd Jianpeng Ma 2021-04-14  147  	struct page *page;
97c62b647fcabd Jianpeng Ma 2021-04-14  148  	long long pages;
97c62b647fcabd Jianpeng Ma 2021-04-14  149  	pgoff_t pgoff_start;
97c62b647fcabd Jianpeng Ma 2021-04-14  150  
97c62b647fcabd Jianpeng Ma 2021-04-14  151  	bitmap_for_each_clear_region(ns->pages_bitmap, start, end, 0, ns->pages_total) {
97c62b647fcabd Jianpeng Ma 2021-04-14  152  		pgoff_start = start;
97c62b647fcabd Jianpeng Ma 2021-04-14  153  		pages = end - start;
97c62b647fcabd Jianpeng Ma 2021-04-14  154  
97c62b647fcabd Jianpeng Ma 2021-04-14  155  		while (pages) {
97c62b647fcabd Jianpeng Ma 2021-04-14 @156  			for (i = BCH_MAX_ORDER - 1; i >= 0 ; i--) {
97c62b647fcabd Jianpeng Ma 2021-04-14  157  				if ((pgoff_start % (1 << i) == 0) && (pages >= (1 << i)))
97c62b647fcabd Jianpeng Ma 2021-04-14  158  					break;
97c62b647fcabd Jianpeng Ma 2021-04-14  159  			}
97c62b647fcabd Jianpeng Ma 2021-04-14  160  
97c62b647fcabd Jianpeng Ma 2021-04-14  161  			page = nvm_vaddr_to_page(ns, nvm_pgoff_to_vaddr(ns, pgoff_start));
97c62b647fcabd Jianpeng Ma 2021-04-14  162  			page->index = pgoff_start;
97c62b647fcabd Jianpeng Ma 2021-04-14  163  			set_page_private(page, i);
97c62b647fcabd Jianpeng Ma 2021-04-14  164  			__SetPageBuddy(page);
97c62b647fcabd Jianpeng Ma 2021-04-14  165  			list_add((struct list_head *)&page->zone_device_data, &ns->free_area[i]);
97c62b647fcabd Jianpeng Ma 2021-04-14  166  
97c62b647fcabd Jianpeng Ma 2021-04-14  167  			pgoff_start += 1 << i;
97c62b647fcabd Jianpeng Ma 2021-04-14  168  			pages -= 1 << i;
97c62b647fcabd Jianpeng Ma 2021-04-14  169  		}
97c62b647fcabd Jianpeng Ma 2021-04-14  170  	}
688330711e9ae3 Jianpeng Ma 2021-04-14  171  }
688330711e9ae3 Jianpeng Ma 2021-04-14  172  

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-04-20 15:01 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-20  8:10 [block:for-5.13/drivers 46/61] drivers/md/bcache/nvm-pages.c:156:34: warning: Unsigned variable 'i' can't be negative so it is unnecessary to test it. [unsignedPositive] Dan Carpenter
2021-04-20  8:10 ` [kbuild] " Dan Carpenter
2021-04-20 13:40 ` Jens Axboe
2021-04-20 14:59   ` Coly Li
2021-04-20 15:01     ` Jens Axboe
  -- strict thread matches above, loose matches on Subject: below --
2021-04-16 16:58 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.