All of lore.kernel.org
 help / color / mirror / Atom feed
* drivers/staging/most/video/video.c:176:22-23: WARNING opportunity for min()
@ 2026-05-05 10:41 kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2026-05-05 10:41 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp, Julia Lawall

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
CC: linux-kernel@vger.kernel.org
TO: Tiwei Bie <tiwei.btw@antgroup.com>
CC: Johannes Berg <johannes.berg@intel.com>

Hi Tiwei,

First bad commit (maybe != root cause):

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   a293ec25d59dd96309058c70df5a4dd0f889a1e4
commit: a0e2cb6a90634f3dc80f16e882a683ee5761b0b0 um: Add VFIO-based virtual PCI driver
date:   1 year ago
:::::: branch date: 12 hours ago
:::::: commit date: 1 year ago
config: um-randconfig-r061-20260505 (https://download.01.org/0day-ci/archive/20260505/202605051807.kGilkgXt-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.4.0-5) 12.4.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
| Fixes: a0e2cb6a9063 ("um: Add VFIO-based virtual PCI driver")
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Julia Lawall <julia.lawall@inria.fr>
| Closes: https://lore.kernel.org/r/202605051807.kGilkgXt-lkp@intel.com/

cocci warnings: (new ones prefixed by >>)
>> drivers/staging/most/video/video.c:176:22-23: WARNING opportunity for min()

vim +176 drivers/staging/most/video/video.c

3d31c0cb6c127b1 drivers/staging/most/aim-v4l2/video.c Christian Gromm 2015-07-24  150  
1b10a0316e2d5e2 drivers/staging/most/video/video.c    Christian Gromm 2017-11-21  151  static ssize_t comp_vdev_read(struct file *filp, char __user *buf,
3d31c0cb6c127b1 drivers/staging/most/aim-v4l2/video.c Christian Gromm 2015-07-24  152  			      size_t count, loff_t *pos)
3d31c0cb6c127b1 drivers/staging/most/aim-v4l2/video.c Christian Gromm 2015-07-24  153  {
1b10a0316e2d5e2 drivers/staging/most/video/video.c    Christian Gromm 2017-11-21  154  	struct comp_fh *fh = filp->private_data;
3d31c0cb6c127b1 drivers/staging/most/aim-v4l2/video.c Christian Gromm 2015-07-24  155  	struct most_video_dev *mdev = fh->mdev;
3d31c0cb6c127b1 drivers/staging/most/aim-v4l2/video.c Christian Gromm 2015-07-24  156  	int ret = 0;
3d31c0cb6c127b1 drivers/staging/most/aim-v4l2/video.c Christian Gromm 2015-07-24  157  
3d31c0cb6c127b1 drivers/staging/most/aim-v4l2/video.c Christian Gromm 2015-07-24  158  	if (*pos)
3d31c0cb6c127b1 drivers/staging/most/aim-v4l2/video.c Christian Gromm 2015-07-24  159  		return -ESPIPE;
3d31c0cb6c127b1 drivers/staging/most/aim-v4l2/video.c Christian Gromm 2015-07-24  160  
3d31c0cb6c127b1 drivers/staging/most/aim-v4l2/video.c Christian Gromm 2015-07-24  161  	if (!mdev)
3d31c0cb6c127b1 drivers/staging/most/aim-v4l2/video.c Christian Gromm 2015-07-24  162  		return -ENODEV;
3d31c0cb6c127b1 drivers/staging/most/aim-v4l2/video.c Christian Gromm 2015-07-24  163  
3d31c0cb6c127b1 drivers/staging/most/aim-v4l2/video.c Christian Gromm 2015-07-24  164  	/* wait for the first buffer */
3d31c0cb6c127b1 drivers/staging/most/aim-v4l2/video.c Christian Gromm 2015-07-24  165  	if (!(filp->f_flags & O_NONBLOCK)) {
3d31c0cb6c127b1 drivers/staging/most/aim-v4l2/video.c Christian Gromm 2015-07-24  166  		if (wait_event_interruptible(mdev->wait_data, data_ready(mdev)))
3d31c0cb6c127b1 drivers/staging/most/aim-v4l2/video.c Christian Gromm 2015-07-24  167  			return -ERESTARTSYS;
3d31c0cb6c127b1 drivers/staging/most/aim-v4l2/video.c Christian Gromm 2015-07-24  168  	}
3d31c0cb6c127b1 drivers/staging/most/aim-v4l2/video.c Christian Gromm 2015-07-24  169  
3d31c0cb6c127b1 drivers/staging/most/aim-v4l2/video.c Christian Gromm 2015-07-24  170  	if (!data_ready(mdev))
3d31c0cb6c127b1 drivers/staging/most/aim-v4l2/video.c Christian Gromm 2015-07-24  171  		return -EAGAIN;
3d31c0cb6c127b1 drivers/staging/most/aim-v4l2/video.c Christian Gromm 2015-07-24  172  
3d31c0cb6c127b1 drivers/staging/most/aim-v4l2/video.c Christian Gromm 2015-07-24  173  	while (count > 0 && data_ready(mdev)) {
3d31c0cb6c127b1 drivers/staging/most/aim-v4l2/video.c Christian Gromm 2015-07-24  174  		struct mbo *const mbo = get_top_mbo(mdev);
3d31c0cb6c127b1 drivers/staging/most/aim-v4l2/video.c Christian Gromm 2015-07-24  175  		int const rem = mbo->processed_length - fh->offs;
3d31c0cb6c127b1 drivers/staging/most/aim-v4l2/video.c Christian Gromm 2015-07-24 @176  		int const cnt = rem < count ? rem : count;
3d31c0cb6c127b1 drivers/staging/most/aim-v4l2/video.c Christian Gromm 2015-07-24  177  
3d31c0cb6c127b1 drivers/staging/most/aim-v4l2/video.c Christian Gromm 2015-07-24  178  		if (copy_to_user(buf, mbo->virt_address + fh->offs, cnt)) {
8f6f9ed15d679ad drivers/staging/most/aim-v4l2/video.c Christian Gromm 2016-06-06  179  			v4l2_err(&mdev->v4l2_dev, "read: copy_to_user failed\n");
3d31c0cb6c127b1 drivers/staging/most/aim-v4l2/video.c Christian Gromm 2015-07-24  180  			if (!ret)
3d31c0cb6c127b1 drivers/staging/most/aim-v4l2/video.c Christian Gromm 2015-07-24  181  				ret = -EFAULT;
3d31c0cb6c127b1 drivers/staging/most/aim-v4l2/video.c Christian Gromm 2015-07-24  182  			return ret;
3d31c0cb6c127b1 drivers/staging/most/aim-v4l2/video.c Christian Gromm 2015-07-24  183  		}
3d31c0cb6c127b1 drivers/staging/most/aim-v4l2/video.c Christian Gromm 2015-07-24  184  
3d31c0cb6c127b1 drivers/staging/most/aim-v4l2/video.c Christian Gromm 2015-07-24  185  		fh->offs += cnt;
3d31c0cb6c127b1 drivers/staging/most/aim-v4l2/video.c Christian Gromm 2015-07-24  186  		count -= cnt;
3d31c0cb6c127b1 drivers/staging/most/aim-v4l2/video.c Christian Gromm 2015-07-24  187  		buf += cnt;
3d31c0cb6c127b1 drivers/staging/most/aim-v4l2/video.c Christian Gromm 2015-07-24  188  		ret += cnt;
3d31c0cb6c127b1 drivers/staging/most/aim-v4l2/video.c Christian Gromm 2015-07-24  189  
3d31c0cb6c127b1 drivers/staging/most/aim-v4l2/video.c Christian Gromm 2015-07-24  190  		if (cnt >= rem) {
3d31c0cb6c127b1 drivers/staging/most/aim-v4l2/video.c Christian Gromm 2015-07-24  191  			fh->offs = 0;
e494df039df0fc7 drivers/staging/most/aim-v4l2/video.c Christian Gromm 2016-06-06  192  			spin_lock_irq(&mdev->list_lock);
3d31c0cb6c127b1 drivers/staging/most/aim-v4l2/video.c Christian Gromm 2015-07-24  193  			list_del(&mbo->list);
e494df039df0fc7 drivers/staging/most/aim-v4l2/video.c Christian Gromm 2016-06-06  194  			spin_unlock_irq(&mdev->list_lock);
3d31c0cb6c127b1 drivers/staging/most/aim-v4l2/video.c Christian Gromm 2015-07-24  195  			most_put_mbo(mbo);
3d31c0cb6c127b1 drivers/staging/most/aim-v4l2/video.c Christian Gromm 2015-07-24  196  		}
3d31c0cb6c127b1 drivers/staging/most/aim-v4l2/video.c Christian Gromm 2015-07-24  197  	}
3d31c0cb6c127b1 drivers/staging/most/aim-v4l2/video.c Christian Gromm 2015-07-24  198  	return ret;
3d31c0cb6c127b1 drivers/staging/most/aim-v4l2/video.c Christian Gromm 2015-07-24  199  }
3d31c0cb6c127b1 drivers/staging/most/aim-v4l2/video.c Christian Gromm 2015-07-24  200  

:::::: The code at line 176 was first introduced by commit
:::::: 3d31c0cb6c127b1d943b610065a05decf821998c Staging: most: add MOST driver's aim-v4l2 module

:::::: TO: Christian Gromm <christian.gromm@microchip.com>
:::::: CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 2+ messages in thread
* drivers/staging/most/video/video.c:176:22-23: WARNING opportunity for min()
@ 2022-02-27 19:50 kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2022-02-27 19:50 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 1113 bytes --]

CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
CC: linux-kernel(a)vger.kernel.org
TO: Denis Efremov <efremov@linux.com>
CC: Julia Lawall <Julia.Lawall@inria.fr>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   2293be58d6a18cab800e25e42081bacb75c05752
commit: 5f66f73b9ff4dcabd4e2405ba9c32e80e02f9408 coccinelle: misc: add minmax script
date:   10 months ago
:::::: branch date: 24 hours ago
:::::: commit date: 10 months ago
config: i386-randconfig-c001 (https://download.01.org/0day-ci/archive/20220228/202202280325.7VS7xl3Q-lkp(a)intel.com/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Julia Lawall <julia.lawall@lip6.fr>


cocci warnings: (new ones prefixed by >>)
>> drivers/staging/most/video/video.c:176:22-23: WARNING opportunity for min()

Please review and possibly fold the followup patch.

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-05-05 10:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-05 10:41 drivers/staging/most/video/video.c:176:22-23: WARNING opportunity for min() kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2022-02-27 19:50 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.