linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [linux-next:master 7125/9096] drivers/scsi/fcoe/fcoe_sysfs.c:283 store_ctlr_mode() warn: unsigned 'ctlr->mode' is never less than zero.
@ 2023-12-20  6:37 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2023-12-20  6:37 UTC (permalink / raw)
  To: Justin Stitt
  Cc: oe-kbuild-all, Linux Memory Management List, Martin K. Petersen,
	Kees Cook, Hannes Reinecke

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

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


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

only message in thread, other threads:[~2023-12-20  6:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-20  6:37 [linux-next:master 7125/9096] drivers/scsi/fcoe/fcoe_sysfs.c:283 store_ctlr_mode() warn: unsigned 'ctlr->mode' is never less than zero kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox