[arm:clearfog 1/11] drivers/net/dsa/mv88e6xxx/mv88e6xxx_debugfs.c:736:6: warning: %d in format string (no. 1) requires 'int but the argument type is 'unsigned int
kernel test robot
lkp at intel.com
Wed Sep 2 17:28:57 EDT 2020
tree: git://git.armlinux.org.uk/~rmk/linux-arm.git clearfog
head: 8ccd5dd41a272bdbcbbffcdfee0841849fc1c8dc
commit: 0153c32fab966f63d6c45ebd4ba9520beda0d1b3 [1/11] net: dsa: mv88e6xxx: add debugfs interface
compiler: h8300-linux-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 >>)
In file included from drivers/net/dsa/mv88e6xxx/chip.c:
>> drivers/net/dsa/mv88e6xxx/mv88e6xxx_debugfs.c:736:6: warning: %d in format string (no. 1) requires 'int *' but the argument type is 'unsigned int *'. [invalidScanfArgType_int]
if (sscanf(cmd, "%d %d %x", &src_dev, &src_port, &pvlan) != 3)
^
drivers/net/dsa/mv88e6xxx/mv88e6xxx_debugfs.c:736:6: warning: %d in format string (no. 2) requires 'int *' but the argument type is 'unsigned int *'. [invalidScanfArgType_int]
if (sscanf(cmd, "%d %d %x", &src_dev, &src_port, &pvlan) != 3)
^
>> drivers/net/dsa/mv88e6xxx/mv88e6xxx_debugfs.c:162:8: warning: sscanf() without field width limits can crash with huge input data. [invalidscanf]
ret = sscanf(cmd, "%s %x %x", name, ®, &val);
^
git remote add arm git://git.armlinux.org.uk/~rmk/linux-arm.git
git fetch --no-tags arm clearfog
git checkout 0153c32fab966f63d6c45ebd4ba9520beda0d1b3
vim +736 drivers/net/dsa/mv88e6xxx/mv88e6xxx_debugfs.c
722
723 static ssize_t mv88e6xxx_pvt_write(struct file *file, const char __user *buf,
724 size_t count, loff_t *ppos)
725 {
726 struct seq_file *s = file->private_data;
727 struct mv88e6xxx_chip *chip = s->private;
728 const u16 mask = (1 << mv88e6xxx_num_ports(chip)) - 1;
729 char cmd[32];
730 unsigned int src_dev, src_port, pvlan;
731 int ret;
732
733 if (copy_from_user(cmd, buf, sizeof(cmd)))
734 return -EFAULT;
735
> 736 if (sscanf(cmd, "%d %d %x", &src_dev, &src_port, &pvlan) != 3)
737 return -EINVAL;
738
739 if (src_dev >= 32 || src_port >= 16 || pvlan & ~mask)
740 return -ERANGE;
741
742 mutex_lock(&chip->reg_lock);
743 ret = _mv88e6xxx_pvt_write(chip, src_dev, src_port, pvlan);
744 mutex_unlock(&chip->reg_lock);
745
746 return ret < 0 ? ret : count;
747 }
748
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
More information about the linux-arm-kernel
mailing list