usb: yurex: Replace snprintf() with the safer scnprintf() variant
kernel test robot
build botBCC: [email protected]
CC: [email protected]
In-Reply-To: <[email protected]>
References: <[email protected]>
TO: Lee Jones <[email protected]>
Hi Lee,
kernel test robot noticed the following build warnings:
[auto build test WARNING on usb/usb-testing]
[also build test WARNING on usb/usb-next usb/usb-linus lee-leds/for-leds-next char-misc/char-misc-testing char-misc/char-misc-next char-misc/char-misc-linus linus/master v6.7-rc5 next-20231215] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Lee-Jones/usb-gadget-configfs-Replace-snprintf-with-the-safer-scnprintf-variant/20231214-004543 base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing patch link: https://lore.kernel.org/r/20231213164246.1021885-9-lee%40kernel.org patch subject: [PATCH 08/12] usb: yurex: Replace snprintf() with the safer scnprintf() variant
:::::: branch date: 3 days ago
:::::: commit date: 3 days ago
config: riscv-randconfig-r081-20231216 (https://download.01.org/0day-ci/archive/20231217/[email protected]/config)
compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project.git 4a5ac14ee968ff0ad5d2cc1ffa0299048db4c88a)
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 <[email protected]> | Reported-by: Dan Carpenter <[email protected]> | Closes: https://lore.kernel.org/r/[email protected]/
smatch warnings:drivers/usb/misc/yurex.c:425 yurex_read() warn: inconsistent returns '&dev->io_mutex'.
vim +425 drivers/usb/misc/yurex.c
6bc235a2e24a5e Tomoki Sekiyama 2010-09-29 400
1cc373c654acde Sudip Mukherjee 2014-10-10 401 static ssize_t yurex_read(struct file *file, char __user *buffer, size_t count,
1cc373c654acde Sudip Mukherjee 2014-10-10 402 loff_t *ppos)
6bc235a2e24a5e Tomoki Sekiyama 2010-09-29 403 {
6bc235a2e24a5e Tomoki Sekiyama 2010-09-29 404 struct usb_yurex *dev;
f1e255d60ae66a Jann Horn 2018-07-06 405 int len = 0;
d9c494521b9f1e Lee Jones 2023-12-13 406 char in_buffer[MAX_S64_STRLEN];
6bc235a2e24a5e Tomoki Sekiyama 2010-09-29 407 unsigned long flags;
6bc235a2e24a5e Tomoki Sekiyama 2010-09-29 408
113ad911ad4a1c Arjun Sreedharan 2014-08-19 409 dev = file->private_data;
6bc235a2e24a5e Tomoki Sekiyama 2010-09-29 410
6bc235a2e24a5e Tomoki Sekiyama 2010-09-29 411 mutex_lock(&dev->io_mutex);
aafb00a977cf7d Johan Hovold 2019-10-09 412 if (dev->disconnected) { /* already disconnected */
f1e255d60ae66a Jann Horn 2018-07-06 413 mutex_unlock(&dev->io_mutex);
f1e255d60ae66a Jann Horn 2018-07-06 414 return -ENODEV;
6bc235a2e24a5e Tomoki Sekiyama 2010-09-29 415 }
6bc235a2e24a5e Tomoki Sekiyama 2010-09-29 416
d9c494521b9f1e Lee Jones 2023-12-13 417 if (WARN_ON_ONCE(dev->bbu > S64_MAX || dev->bbu < S64_MIN))
d9c494521b9f1e Lee Jones 2023-12-13 418 return -EIO;
d9c494521b9f1e Lee Jones 2023-12-13 419
6bc235a2e24a5e Tomoki Sekiyama 2010-09-29 420 spin_lock_irqsave(&dev->lock, flags);
d9c494521b9f1e Lee Jones 2023-12-13 421 scnprintf(in_buffer, MAX_S64_STRLEN, "%lld\n", dev->bbu);
6bc235a2e24a5e Tomoki Sekiyama 2010-09-29 422 spin_unlock_irqrestore(&dev->lock, flags);
6bc235a2e24a5e Tomoki Sekiyama 2010-09-29 423 mutex_unlock(&dev->io_mutex);
f1e255d60ae66a Jann Horn 2018-07-06 424
f1e255d60ae66a Jann Horn 2018-07-06 @425 return simple_read_from_buffer(buffer, count, ppos, in_buffer, len);
6bc235a2e24a5e Tomoki Sekiyama 2010-09-29 426 }
6bc235a2e24a5e Tomoki Sekiyama 2010-09-29 427 Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki