lkml.org 
[lkml]   [2012]   [Apr]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC 2/3] sched: add type checks to for_each_cpu_mask()
On Sat, 14 Apr 2012 18:14:44 -0400
Sasha Levin <levinsasha928@gmail.com> wrote:

> Add type checks to assert that 'mask' is 'struct cpumask *'. This check
> would have detected the bug fixed in e3831ed ("sched: Fix incorrect usage
> of for_each_cpu_mask() in select_fallback_rq()"):
>
> kernel/sched/core.c: In function 'select_fallback_rq':
> kernel/sched/core.c:1273:2: warning: comparison of distinct pointer types lacks a cast
> kernel/sched/core.c:1284:3: warning: comparison of distinct pointer types lacks a cast
>
> ...
>
> @@ -809,6 +810,7 @@ int __next_cpu(int n, const cpumask_t *srcp);
> #define next_cpu(n, src) __next_cpu((n), &(src))
> #define any_online_cpu(mask) cpumask_any_and(&mask, cpu_online_mask)
> #define for_each_cpu_mask(cpu, mask) \
> + typecheck(struct cpumask *, (mask)); \
> for ((cpu) = -1; \
> (cpu) = next_cpu((cpu), (mask)), \
> (cpu) < NR_CPUS; )

and int __next_cpu(int n, const cpumask_t *srcp);

I'm mystified. Why didn't the next_cpu() call generate a warning when
passed the wrong type?


\
 
 \ /
  Last update: 2012-04-21 00:37    [W:0.067 / U:0.148 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site