lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <e872f55b-ca2a-df9d-1f63-8b9b1612d67@inria.fr>
Date: Mon, 30 Sep 2024 17:44:15 +0200 (CEST)
From: Julia Lawall <julia.lawall@...ia.fr>
To: Boris Brezillon <bbrezillon@...nel.org>, 
    Steven Price <steven.price@....com>, linux-kernel@...r.kernel.org, 
    oe-kbuild-all@...ts.linux.dev
Subject: drivers/gpu/drm/panthor/panthor_sched.c:2024:15-20: ERROR: invalid
 reference to the index variable of the iterator on line 1997 (fwd)

The use of group on line 2024 does not look right to me.  It's not
pointing to a meaningful value at this point.

julia

---------- Forwarded message ----------
Date: Mon, 30 Sep 2024 23:39:48 +0800
From: kernel test robot <lkp@...el.com>
To: oe-kbuild@...ts.linux.dev
Cc: lkp@...el.com, Julia Lawall <julia.lawall@...ia.fr>
Subject: drivers/gpu/drm/panthor/panthor_sched.c:2024:15-20: ERROR: invalid
    reference to the index variable of the iterator on line 1997

BCC: lkp@...el.com
CC: oe-kbuild-all@...ts.linux.dev
CC: linux-kernel@...r.kernel.org
TO: Boris Brezillon <bbrezillon@...nel.org>
CC: Steven Price <steven.price@....com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   9852d85ec9d492ebef56dc5f229416c925758edc
commit: d72f049087d4f973f6332b599c92177e718107de drm/panthor: Allow driver compilation
date:   7 months ago
:::::: branch date: 18 hours ago
:::::: commit date: 7 months ago
config: sparc-randconfig-r064-20240930 (https://download.01.org/0day-ci/archive/20240930/202409302306.UDikqa03-lkp@intel.com/config)
compiler: sparc64-linux-gcc (GCC) 14.1.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
| Reported-by: kernel test robot <lkp@...el.com>
| Reported-by: Julia Lawall <julia.lawall@...ia.fr>
| Closes: https://lore.kernel.org/r/202409302306.UDikqa03-lkp@intel.com/

cocci warnings: (new ones prefixed by >>)
>> drivers/gpu/drm/panthor/panthor_sched.c:2024:15-20: ERROR: invalid reference to the index variable of the iterator on line 1997
   drivers/gpu/drm/panthor/panthor_sched.c:2024:15-20: ERROR: invalid reference to the index variable of the iterator on line 2027

vim +2024 drivers/gpu/drm/panthor/panthor_sched.c

de85488138247d Boris Brezillon 2024-02-29  1988
de85488138247d Boris Brezillon 2024-02-29  1989  static void
de85488138247d Boris Brezillon 2024-02-29  1990  tick_ctx_cleanup(struct panthor_scheduler *sched,
de85488138247d Boris Brezillon 2024-02-29  1991  		 struct panthor_sched_tick_ctx *ctx)
de85488138247d Boris Brezillon 2024-02-29  1992  {
de85488138247d Boris Brezillon 2024-02-29  1993  	struct panthor_group *group, *tmp;
de85488138247d Boris Brezillon 2024-02-29  1994  	u32 i;
de85488138247d Boris Brezillon 2024-02-29  1995
de85488138247d Boris Brezillon 2024-02-29  1996  	for (i = 0; i < ARRAY_SIZE(ctx->old_groups); i++) {
de85488138247d Boris Brezillon 2024-02-29 @1997  		list_for_each_entry_safe(group, tmp, &ctx->old_groups[i], run_node) {
de85488138247d Boris Brezillon 2024-02-29  1998  			/* If everything went fine, we should only have groups
de85488138247d Boris Brezillon 2024-02-29  1999  			 * to be terminated in the old_groups lists.
de85488138247d Boris Brezillon 2024-02-29  2000  			 */
de85488138247d Boris Brezillon 2024-02-29  2001  			drm_WARN_ON(&group->ptdev->base, !ctx->csg_upd_failed_mask &&
de85488138247d Boris Brezillon 2024-02-29  2002  				    group_can_run(group));
de85488138247d Boris Brezillon 2024-02-29  2003
de85488138247d Boris Brezillon 2024-02-29  2004  			if (!group_can_run(group)) {
de85488138247d Boris Brezillon 2024-02-29  2005  				list_del_init(&group->run_node);
de85488138247d Boris Brezillon 2024-02-29  2006  				list_del_init(&group->wait_node);
de85488138247d Boris Brezillon 2024-02-29  2007  				group_queue_work(group, term);
de85488138247d Boris Brezillon 2024-02-29  2008  			} else if (group->csg_id >= 0) {
de85488138247d Boris Brezillon 2024-02-29  2009  				list_del_init(&group->run_node);
de85488138247d Boris Brezillon 2024-02-29  2010  			} else {
de85488138247d Boris Brezillon 2024-02-29  2011  				list_move(&group->run_node,
de85488138247d Boris Brezillon 2024-02-29  2012  					  group_is_idle(group) ?
de85488138247d Boris Brezillon 2024-02-29  2013  					  &sched->groups.idle[group->priority] :
de85488138247d Boris Brezillon 2024-02-29  2014  					  &sched->groups.runnable[group->priority]);
de85488138247d Boris Brezillon 2024-02-29  2015  			}
de85488138247d Boris Brezillon 2024-02-29  2016  			group_put(group);
de85488138247d Boris Brezillon 2024-02-29  2017  		}
de85488138247d Boris Brezillon 2024-02-29  2018  	}
de85488138247d Boris Brezillon 2024-02-29  2019
de85488138247d Boris Brezillon 2024-02-29  2020  	for (i = 0; i < ARRAY_SIZE(ctx->groups); i++) {
de85488138247d Boris Brezillon 2024-02-29  2021  		/* If everything went fine, the groups to schedule lists should
de85488138247d Boris Brezillon 2024-02-29  2022  		 * be empty.
de85488138247d Boris Brezillon 2024-02-29  2023  		 */
de85488138247d Boris Brezillon 2024-02-29 @2024  		drm_WARN_ON(&group->ptdev->base,
de85488138247d Boris Brezillon 2024-02-29  2025  			    !ctx->csg_upd_failed_mask && !list_empty(&ctx->groups[i]));
de85488138247d Boris Brezillon 2024-02-29  2026
de85488138247d Boris Brezillon 2024-02-29  2027  		list_for_each_entry_safe(group, tmp, &ctx->groups[i], run_node) {
de85488138247d Boris Brezillon 2024-02-29  2028  			if (group->csg_id >= 0) {
de85488138247d Boris Brezillon 2024-02-29  2029  				list_del_init(&group->run_node);
de85488138247d Boris Brezillon 2024-02-29  2030  			} else {
de85488138247d Boris Brezillon 2024-02-29  2031  				list_move(&group->run_node,
de85488138247d Boris Brezillon 2024-02-29  2032  					  group_is_idle(group) ?
de85488138247d Boris Brezillon 2024-02-29  2033  					  &sched->groups.idle[group->priority] :
de85488138247d Boris Brezillon 2024-02-29  2034  					  &sched->groups.runnable[group->priority]);
de85488138247d Boris Brezillon 2024-02-29  2035  			}
de85488138247d Boris Brezillon 2024-02-29  2036  			group_put(group);
de85488138247d Boris Brezillon 2024-02-29  2037  		}
de85488138247d Boris Brezillon 2024-02-29  2038  	}
de85488138247d Boris Brezillon 2024-02-29  2039  }
de85488138247d Boris Brezillon 2024-02-29  2040

:::::: The code at line 2024 was first introduced by commit
:::::: de85488138247d034eb3241840424a54d660926b drm/panthor: Add the scheduler logical block

:::::: TO: Boris Brezillon <boris.brezillon@...labora.com>
:::::: CC: Boris Brezillon <boris.brezillon@...labora.com>

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ