[tip:sched/core 1/5] kernel/sched/syscalls.c:1196:1: sparse: sparse: Using plain integer as NULL pointer

From: kernel test robot
Date: Fri Jun 07 2024 - 08:25:24 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git sched/core
head: c793a62823d1ce8f70d9cfc7803e3ea436277cda
commit: 04746ed80bcf3130951ed4d5c1bc5b0bcabdde22 [1/5] sched/syscalls: Split out kernel/sched/syscalls.c from kernel/sched/core.c
config: s390-randconfig-r113-20240607 (https://download.01.org/0day-ci/archive/20240607/202406072031.0qiY7y7d-lkp@xxxxxxxxx/config)
compiler: s390-linux-gcc (GCC) 13.2.0
reproduce: (https://download.01.org/0day-ci/archive/20240607/202406072031.0qiY7y7d-lkp@xxxxxxxxx/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 <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202406072031.0qiY7y7d-lkp@xxxxxxxxx/

sparse warnings: (new ones prefixed by >>)
kernel/sched/rt.c:2044:40: sparse: expected struct task_struct *task
kernel/sched/rt.c:2044:40: sparse: got struct task_struct [noderef] __rcu *curr
kernel/sched/rt.c:2067:13: sparse: sparse: incompatible types in comparison expression (different address spaces):
kernel/sched/rt.c:2067:13: sparse: struct task_struct *
kernel/sched/rt.c:2067:13: sparse: struct task_struct [noderef] __rcu *
kernel/sched/rt.c:2417:54: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct task_struct *tsk @@ got struct task_struct [noderef] __rcu *curr @@
kernel/sched/rt.c:2417:54: sparse: expected struct task_struct *tsk
kernel/sched/rt.c:2417:54: sparse: got struct task_struct [noderef] __rcu *curr
kernel/sched/rt.c:2419:40: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct task_struct *p @@ got struct task_struct [noderef] __rcu *curr @@
kernel/sched/rt.c:2419:40: sparse: expected struct task_struct *p
kernel/sched/rt.c:2419:40: sparse: got struct task_struct [noderef] __rcu *curr
kernel/sched/rt.c:2419:61: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct task_struct *p @@ got struct task_struct [noderef] __rcu *curr @@
kernel/sched/rt.c:2419:61: sparse: expected struct task_struct *p
kernel/sched/rt.c:2419:61: sparse: got struct task_struct [noderef] __rcu *curr
kernel/sched/build_policy.c: note: in included file:
kernel/sched/deadline.c:2401:23: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct task_struct *p @@ got struct task_struct [noderef] __rcu *curr @@
kernel/sched/deadline.c:2401:23: sparse: expected struct task_struct *p
kernel/sched/deadline.c:2401:23: sparse: got struct task_struct [noderef] __rcu *curr
kernel/sched/deadline.c:2411:13: sparse: sparse: incompatible types in comparison expression (different address spaces):
kernel/sched/deadline.c:2411:13: sparse: struct task_struct *
kernel/sched/deadline.c:2411:13: sparse: struct task_struct [noderef] __rcu *
kernel/sched/deadline.c:2519:25: sparse: sparse: incompatible types in comparison expression (different address spaces):
kernel/sched/deadline.c:2519:25: sparse: struct task_struct *
kernel/sched/deadline.c:2519:25: sparse: struct task_struct [noderef] __rcu *
kernel/sched/deadline.c:2026:42: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected struct sched_dl_entity const *b @@ got struct sched_dl_entity [noderef] __rcu * @@
kernel/sched/deadline.c:2026:42: sparse: expected struct sched_dl_entity const *b
kernel/sched/deadline.c:2026:42: sparse: got struct sched_dl_entity [noderef] __rcu *
kernel/sched/deadline.c:2037:38: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct task_struct *tsk @@ got struct task_struct [noderef] __rcu *curr @@
kernel/sched/deadline.c:2037:38: sparse: expected struct task_struct *tsk
kernel/sched/deadline.c:2037:38: sparse: got struct task_struct [noderef] __rcu *curr
kernel/sched/deadline.c:1220:23: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct task_struct *p @@ got struct task_struct [noderef] __rcu *curr @@
kernel/sched/deadline.c:1220:23: sparse: expected struct task_struct *p
kernel/sched/deadline.c:1220:23: sparse: got struct task_struct [noderef] __rcu *curr
kernel/sched/deadline.c:1444:38: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected struct task_struct *curr @@ got struct task_struct [noderef] __rcu *curr @@
kernel/sched/deadline.c:1444:38: sparse: expected struct task_struct *curr
kernel/sched/deadline.c:1444:38: sparse: got struct task_struct [noderef] __rcu *curr
kernel/sched/deadline.c:2262:9: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct sched_domain *[assigned] sd @@ got struct sched_domain [noderef] __rcu *parent @@
kernel/sched/deadline.c:2262:9: sparse: expected struct sched_domain *[assigned] sd
kernel/sched/deadline.c:2262:9: sparse: got struct sched_domain [noderef] __rcu *parent
kernel/sched/deadline.c:1911:14: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct task_struct *curr @@ got struct task_struct [noderef] __rcu * @@
kernel/sched/deadline.c:1911:14: sparse: expected struct task_struct *curr
kernel/sched/deadline.c:1911:14: sparse: got struct task_struct [noderef] __rcu *
kernel/sched/deadline.c:1987:43: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected struct task_struct *p @@ got struct task_struct [noderef] __rcu *curr @@
kernel/sched/deadline.c:1987:43: sparse: expected struct task_struct *p
kernel/sched/deadline.c:1987:43: sparse: got struct task_struct [noderef] __rcu *curr
kernel/sched/deadline.c:2566:38: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct task_struct *tsk @@ got struct task_struct [noderef] __rcu *curr @@
kernel/sched/deadline.c:2566:38: sparse: expected struct task_struct *tsk
kernel/sched/deadline.c:2566:38: sparse: got struct task_struct [noderef] __rcu *curr
kernel/sched/deadline.c:2568:23: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct task_struct *p @@ got struct task_struct [noderef] __rcu *curr @@
kernel/sched/deadline.c:2568:23: sparse: expected struct task_struct *p
kernel/sched/deadline.c:2568:23: sparse: got struct task_struct [noderef] __rcu *curr
kernel/sched/deadline.c:2570:44: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected struct sched_dl_entity const *b @@ got struct sched_dl_entity [noderef] __rcu * @@
kernel/sched/deadline.c:2570:44: sparse: expected struct sched_dl_entity const *b
kernel/sched/deadline.c:2570:44: sparse: got struct sched_dl_entity [noderef] __rcu *
kernel/sched/deadline.c:2745:22: sparse: sparse: incompatible types in comparison expression (different address spaces):
kernel/sched/deadline.c:2745:22: sparse: struct task_struct [noderef] __rcu *
kernel/sched/deadline.c:2745:22: sparse: struct task_struct *
kernel/sched/deadline.c:2794:32: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct task_struct *p @@ got struct task_struct [noderef] __rcu *curr @@
kernel/sched/build_policy.c: note: in included file:
kernel/sched/syscalls.c:206:22: sparse: sparse: incompatible types in comparison expression (different address spaces):
kernel/sched/syscalls.c:206:22: sparse: struct task_struct [noderef] __rcu *
kernel/sched/syscalls.c:206:22: sparse: struct task_struct *
kernel/sched/syscalls.c:253:48: sparse: sparse: incompatible types in comparison expression (different address spaces):
kernel/sched/syscalls.c:253:48: sparse: struct task_struct [noderef] __rcu *
kernel/sched/syscalls.c:253:48: sparse: struct task_struct *
kernel/sched/build_policy.c: note: in included file:
kernel/sched/sched.h:2156:25: sparse: sparse: incompatible types in comparison expression (different address spaces):
kernel/sched/sched.h:2156:25: sparse: struct task_struct [noderef] __rcu *
kernel/sched/sched.h:2156:25: sparse: struct task_struct *
kernel/sched/sched.h:2156:25: sparse: sparse: incompatible types in comparison expression (different address spaces):
kernel/sched/sched.h:2156:25: sparse: struct task_struct [noderef] __rcu *
kernel/sched/sched.h:2156:25: sparse: struct task_struct *
kernel/sched/sched.h:2156:25: sparse: sparse: incompatible types in comparison expression (different address spaces):
kernel/sched/sched.h:2156:25: sparse: struct task_struct [noderef] __rcu *
kernel/sched/sched.h:2156:25: sparse: struct task_struct *
kernel/sched/sched.h:2156:25: sparse: sparse: incompatible types in comparison expression (different address spaces):
kernel/sched/sched.h:2156:25: sparse: struct task_struct [noderef] __rcu *
kernel/sched/sched.h:2156:25: sparse: struct task_struct *
kernel/sched/sched.h:2156:25: sparse: sparse: incompatible types in comparison expression (different address spaces):
kernel/sched/sched.h:2156:25: sparse: struct task_struct [noderef] __rcu *
kernel/sched/sched.h:2156:25: sparse: struct task_struct *
kernel/sched/sched.h:2156:25: sparse: sparse: incompatible types in comparison expression (different address spaces):
kernel/sched/sched.h:2156:25: sparse: struct task_struct [noderef] __rcu *
kernel/sched/sched.h:2156:25: sparse: struct task_struct *
kernel/sched/sched.h:2156:25: sparse: sparse: incompatible types in comparison expression (different address spaces):
kernel/sched/sched.h:2156:25: sparse: struct task_struct [noderef] __rcu *
kernel/sched/sched.h:2156:25: sparse: struct task_struct *
kernel/sched/sched.h:2156:25: sparse: sparse: incompatible types in comparison expression (different address spaces):
kernel/sched/sched.h:2156:25: sparse: struct task_struct [noderef] __rcu *
kernel/sched/sched.h:2156:25: sparse: struct task_struct *
kernel/sched/sched.h:2328:9: sparse: sparse: incompatible types in comparison expression (different address spaces):
kernel/sched/sched.h:2328:9: sparse: struct task_struct [noderef] __rcu *
kernel/sched/sched.h:2328:9: sparse: struct task_struct *
kernel/sched/sched.h:2156:25: sparse: sparse: incompatible types in comparison expression (different address spaces):
kernel/sched/sched.h:2156:25: sparse: struct task_struct [noderef] __rcu *
kernel/sched/sched.h:2156:25: sparse: struct task_struct *
kernel/sched/sched.h:2328:9: sparse: sparse: incompatible types in comparison expression (different address spaces):
kernel/sched/sched.h:2328:9: sparse: struct task_struct [noderef] __rcu *
kernel/sched/sched.h:2328:9: sparse: struct task_struct *
kernel/sched/build_policy.c: note: in included file:
>> kernel/sched/syscalls.c:1196:1: sparse: sparse: Using plain integer as NULL pointer
>> kernel/sched/syscalls.c:1196:1: sparse: sparse: Using plain integer as NULL pointer
kernel/sched/syscalls.c:1386:1: sparse: sparse: Using plain integer as NULL pointer
kernel/sched/syscalls.c:1386:1: sparse: sparse: Using plain integer as NULL pointer
kernel/sched/syscalls.c:1402:6: sparse: sparse: context imbalance in 'sched_getaffinity' - different lock contexts for basic block
kernel/sched/syscalls.c:1431:1: sparse: sparse: Using plain integer as NULL pointer
kernel/sched/syscalls.c:1431:1: sparse: sparse: Using plain integer as NULL pointer
kernel/sched/syscalls.c:1676:1: sparse: sparse: Using plain integer as NULL pointer
kernel/sched/syscalls.c:1676:1: sparse: sparse: Using plain integer as NULL pointer
kernel/sched/build_policy.c: note: in included file:
kernel/sched/rt.c:1707:15: sparse: sparse: dereference of noderef expression

vim +1196 kernel/sched/syscalls.c

1188
1189 /**
1190 * sys_sched_getattr - similar to sched_getparam, but with sched_attr
1191 * @pid: the pid in question.
1192 * @uattr: structure containing the extended parameters.
1193 * @usize: sizeof(attr) for fwd/bwd comp.
1194 * @flags: for future extension.
1195 */
> 1196 SYSCALL_DEFINE4(sched_getattr, pid_t, pid, struct sched_attr __user *, uattr,
1197 unsigned int, usize, unsigned int, flags)
1198 {
1199 struct sched_attr kattr = { };
1200 struct task_struct *p;
1201 int retval;
1202
1203 if (!uattr || pid < 0 || usize > PAGE_SIZE ||
1204 usize < SCHED_ATTR_SIZE_VER0 || flags)
1205 return -EINVAL;
1206
1207 scoped_guard (rcu) {
1208 p = find_process_by_pid(pid);
1209 if (!p)
1210 return -ESRCH;
1211
1212 retval = security_task_getscheduler(p);
1213 if (retval)
1214 return retval;
1215
1216 kattr.sched_policy = p->policy;
1217 if (p->sched_reset_on_fork)
1218 kattr.sched_flags |= SCHED_FLAG_RESET_ON_FORK;
1219 get_params(p, &kattr);
1220 kattr.sched_flags &= SCHED_FLAG_ALL;
1221

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