2023-09-01 07:36:40

by Paul E. McKenney

[permalink] [raw]
Subject: Re: [paulmck-rcu:dev.2023.08.22a 63/69] kernel/locking/locktorture.c:294:20-23: ERROR: t is NULL but dereferenced. (fwd)

On Thu, Aug 31, 2023 at 11:01:02AM +0200, Julia Lawall wrote:
> Maybe a ! has been forgotton on line 290?

Right you are, and thank you!

I will go get my brown paper bag. ;-)

Thanx, Paul

> julia
>
> ---------- Forwarded message ----------
> Date: Thu, 31 Aug 2023 10:46:56 +0800
> From: kernel test robot <[email protected]>
> To: [email protected]
> Cc: [email protected], Julia Lawall <[email protected]>
> Subject: [paulmck-rcu:dev.2023.08.22a 63/69]
> kernel/locking/locktorture.c:294:20-23: ERROR: t is NULL but dereferenced.
>
> BCC: [email protected]
> CC: [email protected]
> CC: [email protected]
> TO: "Paul E. McKenney" <[email protected]>
>
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git dev.2023.08.22a
> head: 354957ec11dc80eac68c4b1e10c237d69adc1833
> commit: 758918804e0d5216981df3cef99ffd7ba0842192 [63/69] locktorture: Add indication of task write-holding lock
> :::::: branch date: 6 days ago
> :::::: commit date: 7 days ago
> config: i386-randconfig-053-20230831 (https://download.01.org/0day-ci/archive/20230831/[email protected]/config)
> compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0
> reproduce: (https://download.01.org/0day-ci/archive/20230831/[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: Julia Lawall <[email protected]>
> | Closes: https://lore.kernel.org/r/[email protected]/
>
> cocci warnings: (new ones prefixed by >>)
> >> kernel/locking/locktorture.c:294:20-23: ERROR: t is NULL but dereferenced.
> kernel/locking/locktorture.c:294:43-47: ERROR: t is NULL but dereferenced.
>
> vim +294 kernel/locking/locktorture.c
>
> bdd8d60bd4047a Paul E. McKenney 2023-08-23 284
> 94a8fb5e4673d7 Paul E. McKenney 2023-08-22 285 static int torture_spin_lock_dump(struct notifier_block *nb, unsigned long v, void *ptr)
> 94a8fb5e4673d7 Paul E. McKenney 2023-08-22 286 {
> 758918804e0d52 Paul E. McKenney 2023-08-23 287 struct task_struct *t = READ_ONCE(lock_is_write_held);
> 758918804e0d52 Paul E. McKenney 2023-08-23 288
> 94a8fb5e4673d7 Paul E. McKenney 2023-08-22 289 pr_alert("%s invoked: v=%lu, duration=%lu.\n", __func__, v, (unsigned long)ptr);
> 758918804e0d52 Paul E. McKenney 2023-08-23 290 if (t) {
> 758918804e0d52 Paul E. McKenney 2023-08-23 291 pr_alert("%s No task holding lock.\n", __func__);
> 758918804e0d52 Paul E. McKenney 2023-08-23 292 } else {
> 758918804e0d52 Paul E. McKenney 2023-08-23 293 pr_alert("%s Lock held by task %ps %d %*s\n",
> 758918804e0d52 Paul E. McKenney 2023-08-23 @294 __func__, t, t->pid, TASK_COMM_LEN, t->comm);
> 758918804e0d52 Paul E. McKenney 2023-08-23 295 sched_show_task(t);
> 758918804e0d52 Paul E. McKenney 2023-08-23 296 }
> bdd8d60bd4047a Paul E. McKenney 2023-08-23 297 spinlock_dump(&torture_spinlock, true);
> 94a8fb5e4673d7 Paul E. McKenney 2023-08-22 298 return NOTIFY_OK;
> 94a8fb5e4673d7 Paul E. McKenney 2023-08-22 299 }
> 94a8fb5e4673d7 Paul E. McKenney 2023-08-22 300
>
> --
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests/wiki