[linux-nvme:nvme-5.11 1/23] drivers/nvme/target/fcloop.c:1506:6: warning: %x in format string (no. 1) requires 'unsigned int but the argument type is 'signed int

kernel test robot lkp at intel.com
Wed Dec 2 16:03:21 EST 2020


tree:   git://git.infradead.org/nvme.git nvme-5.11
head:   2f4c9ba23b887e7a69a474e9d53f38b5833a2119
commit: 03d99e5d63dabe2c0cea0d8fe1cb89bde33f7939 [1/23] nvme-fcloop: add sysfs attribute to inject command drop
compiler: c6x-elf-gcc (GCC) 9.3.0

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


"cppcheck warnings: (new ones prefixed by >>)"
>> drivers/nvme/target/fcloop.c:1506:6: warning: %x in format string (no. 1) requires 'unsigned int *' but the argument type is 'signed int *'. [invalidScanfArgType_int]
    if (sscanf(buf, "%x:%d:%d", &opcode, &starting, &amount) != 3)
        ^
   drivers/nvme/target/fcloop.c:1632:32: warning: Uninitialized variable: lport [uninitvar]
     ret = __wait_localport_unreg(lport);
                                  ^
   drivers/nvme/target/fcloop.c:1615:28: warning: Uninitialized variable: nport [uninitvar]
     ret = __remoteport_unreg(nport, rport);
                              ^

vim +1506 drivers/nvme/target/fcloop.c

  1499	
  1500	static ssize_t
  1501	fcloop_set_cmd_drop(struct device *dev, struct device_attribute *attr,
  1502			const char *buf, size_t count)
  1503	{
  1504		int opcode, starting, amount;
  1505	
> 1506		if (sscanf(buf, "%x:%d:%d", &opcode, &starting, &amount) != 3)
  1507			return -EBADRQC;
  1508	
  1509		drop_current_cnt = 0;
  1510		drop_fabric_opcode = (opcode & ~DROP_OPCODE_MASK) ? true : false;
  1511		drop_opcode = (opcode & DROP_OPCODE_MASK);
  1512		drop_instance = starting;
  1513		/* the check to drop routine uses instance + count to know when
  1514		 * to end. Thus, if dropping 1 instance, count should be 0.
  1515		 * so subtract 1 from the count.
  1516		 */
  1517		drop_amount = amount - 1;
  1518	
  1519		pr_info("%s: DROP: Starting at instance %d of%s opcode x%x drop +%d "
  1520			"instances\n",
  1521			__func__, drop_instance, drop_fabric_opcode ? " fabric" : "",
  1522			drop_opcode, drop_amount);
  1523	
  1524		return count;
  1525	}
  1526	

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



More information about the Linux-nvme mailing list