[linux-next:master 7125/9096] drivers/scsi/fcoe/fcoe_sysfs.c:283 store_ctlr_mode() warn: unsigned 'ctlr->mode' is never less than zero.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   aa4db8324c4d0e67aa4670356df4e9fae14b4d37
commit: edc22a7c86888d1f2442e359c3b33a861045e9cd [7125/9096] scsi: fcoe: Use sysfs_match_string() over fcoe_parse_mode()
config: x86_64-randconfig-161-20231220 (https://download.01.org/0day-ci/archive/20231220/202312201409.y5nmYEx3-lkp@xxxxxxxxx/config)
compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.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@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202312201409.y5nmYEx3-lkp@xxxxxxxxx/

smatch warnings:
drivers/scsi/fcoe/fcoe_sysfs.c:283 store_ctlr_mode() warn: unsigned 'ctlr->mode' is never less than zero.

vim +283 drivers/scsi/fcoe/fcoe_sysfs.c

   260	
   261	static ssize_t store_ctlr_mode(struct device *dev,
   262				       struct device_attribute *attr,
   263				       const char *buf, size_t count)
   264	{
   265		struct fcoe_ctlr_device *ctlr = dev_to_ctlr(dev);
   266	
   267		if (count > FCOE_MAX_MODENAME_LEN)
   268			return -EINVAL;
   269	
   270	
   271		switch (ctlr->enabled) {
   272		case FCOE_CTLR_ENABLED:
   273			LIBFCOE_SYSFS_DBG(ctlr, "Cannot change mode when enabled.\n");
   274			return -EBUSY;
   275		case FCOE_CTLR_DISABLED:
   276			if (!ctlr->f->set_fcoe_ctlr_mode) {
   277				LIBFCOE_SYSFS_DBG(ctlr,
   278						  "Mode change not supported by LLD.\n");
   279				return -ENOTSUPP;
   280			}
   281	
   282			ctlr->mode = sysfs_match_string(fip_conn_type_names, buf);
 > 283			if (ctlr->mode < 0 || ctlr->mode == FIP_CONN_TYPE_UNKNOWN) {
   284				LIBFCOE_SYSFS_DBG(ctlr, "Unknown mode %s provided.\n",
   285						  buf);
   286				return -EINVAL;
   287			}
   288	
   289			ctlr->f->set_fcoe_ctlr_mode(ctlr);
   290			LIBFCOE_SYSFS_DBG(ctlr, "Mode changed to %s.\n", buf);
   291	
   292			return count;
   293		case FCOE_CTLR_UNUSED:
   294		default:
   295			LIBFCOE_SYSFS_DBG(ctlr, "Mode change not supported.\n");
   296			return -ENOTSUPP;
   297		}
   298	}
   299	

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




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux