Re: [PATCH v3 3/3] overflow: Remove is_non_negative() and is_negative()

kernel test robot
2025-12-27T08:50:24Z

Hi Vincent,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 3e7f562e20ee87a25e104ef4fce557d39d62fa85]

url: https://github.com/intel-lab-lkp/linux/commits/Vincent-Mailhol/kbuild-remove-gcc-s-Wtype-limits/20251220-190509
base: 3e7f562e20ee87a25e104ef4fce557d39d62fa85
patch link: https://lore.kernel.org/r/20251220-remove_wtype-limits-v3-3-24b170af700e%40kernel.org
patch subject: [PATCH v3 3/3] overflow: Remove is_non_negative() and is_negative()
config: sparc-randconfig-r072-20251227 (https://download.01.org/0day-ci/archive/20251227/202512271618.33YepxDC-lkp@intel.com/config)
compiler: sparc64-linux-gcc (GCC) 15.1.0

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@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202512271618.33YepxDC-lkp@intel.com/

smatch warnings:
drivers/block/nbd.c:1612 __nbd_ioctl() warn: unsigned '_a' is never less than zero.

vim +/_a +1612 drivers/block/nbd.c

55313e92bd17a87 Mike Christie 2019-08-13 1591
9442b739207aab6 Josef Bacik 2017-02-07 1592 /* Must be called with config_lock held */
9442b739207aab6 Josef Bacik 2017-02-07 1593 static int __nbd_ioctl(struct block_device *bdev, struct nbd_device *nbd,
9442b739207aab6 Josef Bacik 2017-02-07 1594 unsigned int cmd, unsigned long arg)
9442b739207aab6 Josef Bacik 2017-02-07 1595 {
5ea8d10802ec4c1 Josef Bacik 2017-04-06 1596 struct nbd_config *config = nbd->config;
fad7cd3310db309 Baokun Li 2021-08-04 1597 loff_t bytesize;
5ea8d10802ec4c1 Josef Bacik 2017-04-06 1598
9442b739207aab6 Josef Bacik 2017-02-07 1599 switch (cmd) {
9442b739207aab6 Josef Bacik 2017-02-07 1600 case NBD_DISCONNECT:
29eaadc0364943b Josef Bacik 2017-04-06 1601 return nbd_disconnect(nbd);
9442b739207aab6 Josef Bacik 2017-02-07 1602 case NBD_CLEAR_SOCK:
0c1c9a27ce909e3 Christoph Hellwig 2023-08-11 1603 nbd_clear_sock_ioctl(nbd);
29eaadc0364943b Josef Bacik 2017-04-06 1604 return 0;
9442b739207aab6 Josef Bacik 2017-02-07 1605 case NBD_SET_SOCK:
e46c7287b1c2768 Josef Bacik 2017-04-06 1606 return nbd_add_socket(nbd, arg, false);
9442b739207aab6 Josef Bacik 2017-02-07 1607 case NBD_SET_BLKSIZE:
dcbddf541f18e36 Christoph Hellwig 2020-11-16 1608 return nbd_set_size(nbd, config->bytesize, arg);
9442b739207aab6 Josef Bacik 2017-02-07 1609 case NBD_SET_SIZE:
41e76c6a3c83c85 Nick Desaulniers 2021-09-20 1610 return nbd_set_size(nbd, arg, nbd_blksize(config));
9442b739207aab6 Josef Bacik 2017-02-07 1611 case NBD_SET_SIZE_BLOCKS:
41e76c6a3c83c85 Nick Desaulniers 2021-09-20 @1612 if (check_shl_overflow(arg, config->blksize_bits, &bytesize))
fad7cd3310db309 Baokun Li 2021-08-04 1613 return -EINVAL;
41e76c6a3c83c85 Nick Desaulniers 2021-09-20 1614 return nbd_set_size(nbd, bytesize, nbd_blksize(config));
9442b739207aab6 Josef Bacik 2017-02-07 1615 case NBD_SET_TIMEOUT:
55313e92bd17a87 Mike Christie 2019-08-13 1616 nbd_set_cmd_timeout(nbd, arg);
9442b739207aab6 Josef Bacik 2017-02-07 1617 return 0;
9442b739207aab6 Josef Bacik 2017-02-07 1618
9442b739207aab6 Josef Bacik 2017-02-07 1619 case NBD_SET_FLAGS:
5ea8d10802ec4c1 Josef Bacik 2017-04-06 1620 config->flags = arg;
9442b739207aab6 Josef Bacik 2017-02-07 1621 return 0;
9442b739207aab6 Josef Bacik 2017-02-07 1622 case NBD_DO_IT:
2a852a693f8839b Christoph Hellwig 2022-03-30 1623 return nbd_start_device_ioctl(nbd);
^1da177e4c3f415 Linus Torvalds 2005-04-16 1624 case NBD_CLEAR_QUE:
4b2f0260c74324a Herbert Xu 2006-01-06 1625 /*
4b2f0260c74324a Herbert Xu 2006-01-06 1626 * This is for compatibility only. The queue is always cleared
4b2f0260c74324a Herbert Xu 2006-01-06 1627 * by NBD_DO_IT or NBD_CLEAR_SOCK.
4b2f0260c74324a Herbert Xu 2006-01-06 1628 */
^1da177e4c3f415 Linus Torvalds 2005-04-16 1629 return 0;
^1da177e4c3f415 Linus Torvalds 2005-04-16 1630 case NBD_PRINT_DEBUG:
fd8383fd88a2fd8 Josef Bacik 2016-09-08 1631 /*
fd8383fd88a2fd8 Josef Bacik 2016-09-08 1632 * For compatibility only, we no longer keep a list of
fd8383fd88a2fd8 Josef Bacik 2016-09-08 1633 * outstanding requests.
fd8383fd88a2fd8 Josef Bacik 2016-09-08 1634 */
^1da177e4c3f415 Linus Torvalds 2005-04-16 1635 return 0;
^1da177e4c3f415 Linus Torvalds 2005-04-16 1636 }
1a2ad21128bb4eb Pavel Machek 2009-04-02 1637 return -ENOTTY;
1a2ad21128bb4eb Pavel Machek 2009-04-02 1638 }
1a2ad21128bb4eb Pavel Machek 2009-04-02 1639

--
0-DAY CI Kernel Test Service