check for integer overflow ‘timeout’

drivers/fsi/fsi-sbefifo.c:978 sbefifo_read_timeout() warn: check for integer overflow ‘timeout’

* drivers/fsi/fsi-sbefifo.c:978 sbefifo_read_timeout() warn: check for integer overflow 'timeout'
@ 2023-09-03 20:00 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2023-09-03 20:00 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp, Dan Carpenter

BCC: [email protected]
CC: [email protected]
CC: [email protected]
TO: Eddie James <[email protected]>
CC: Joel Stanley <[email protected]>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   708283abf896dd4853e673cc8cba70acaf9bf4ea
commit: 2f42220f350049e15df026ad87be36d967102cbf fsi: sbefifo: Remove limits on user-specified read timeout
date:   4 weeks ago
:::::: branch date: 2 hours ago
:::::: commit date: 4 weeks ago
config: x86_64-randconfig-161-20230903 (https://download.01.org/0day-ci/archive/20230904/[email protected]/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce: (https://download.01.org/0day-ci/archive/20230904/[email protected]/reproduce)

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]/

New smatch warnings:
drivers/fsi/fsi-sbefifo.c:978 sbefifo_read_timeout() warn: check for integer overflow 'timeout'

Old smatch warnings:
drivers/fsi/fsi-sbefifo.c:959 sbefifo_cmd_timeout() warn: check for integer overflow 'timeout'

vim +/timeout +978 drivers/fsi/fsi-sbefifo.c

19c064defcce755 Eddie James   2023-06-12  963  
a1dc6308865df71 Amitay Isaacs 2022-01-21  964  static int sbefifo_read_timeout(struct sbefifo_user *user, void __user *argp)
a1dc6308865df71 Amitay Isaacs 2022-01-21  965  {
a1dc6308865df71 Amitay Isaacs 2022-01-21  966  	struct device *dev = &user->sbefifo->dev;
a1dc6308865df71 Amitay Isaacs 2022-01-21  967  	u32 timeout;
a1dc6308865df71 Amitay Isaacs 2022-01-21  968  
a1dc6308865df71 Amitay Isaacs 2022-01-21  969  	if (get_user(timeout, (__u32 __user *)argp))
a1dc6308865df71 Amitay Isaacs 2022-01-21  970  		return -EFAULT;
a1dc6308865df71 Amitay Isaacs 2022-01-21  971  
a1dc6308865df71 Amitay Isaacs 2022-01-21  972  	if (timeout == 0) {
a1dc6308865df71 Amitay Isaacs 2022-01-21  973  		user->read_timeout_ms = SBEFIFO_TIMEOUT_START_RSP;
2f42220f350049e Eddie James   2023-06-12  974  		dev_dbg(dev, "Timeout reset to %us\n", user->read_timeout_ms / 1000);
a1dc6308865df71 Amitay Isaacs 2022-01-21  975  		return 0;
a1dc6308865df71 Amitay Isaacs 2022-01-21  976  	}
a1dc6308865df71 Amitay Isaacs 2022-01-21  977  
a1dc6308865df71 Amitay Isaacs 2022-01-21 @978  	user->read_timeout_ms = timeout * 1000; /* user timeout is in sec */
2f42220f350049e Eddie James   2023-06-12  979  	dev_dbg(dev, "Timeout set to %us\n", timeout);
a1dc6308865df71 Amitay Isaacs 2022-01-21  980  	return 0;
a1dc6308865df71 Amitay Isaacs 2022-01-21  981  }
a1dc6308865df71 Amitay Isaacs 2022-01-21  982  

:::::: The code at line 978 was first introduced by commit
:::::: a1dc6308865df719efb2a2f8a5f0f5979602d267 fsi: sbefifo: Implement FSI_SBEFIFO_READ_TIMEOUT_SECONDS ioctl

:::::: TO: Amitay Isaacs <[email protected]>
:::::: CC: Joel Stanley <[email protected]>

-- 
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-09-03 20:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-03 20:00 drivers/fsi/fsi-sbefifo.c:978 sbefifo_read_timeout() warn: check for integer overflow 'timeout' kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.

Read more here: Source link