All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Sasha Levin <levinsasha928@gmail.com>
Cc: torvalds@linux-foundation.org, peterz@infradead.org,
	mingo@elte.hu, hpa@zytor.com, tglx@linutronix.de,
	srivatsa.bhat@linux.vnet.ibm.com, linux-kernel@vger.kernel.org
Subject: Re: [RFC 2/3] sched: add type checks to for_each_cpu_mask()
Date: Fri, 20 Apr 2012 15:33:51 -0700	[thread overview]
Message-ID: <20120420153351.53085ed9.akpm@linux-foundation.org> (raw)
In-Reply-To: <1334441685-4438-3-git-send-email-levinsasha928@gmail.com>

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?

  parent reply	other threads:[~2012-04-20 22:33 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-14 22:14 [RFC 0/3] Extend type checking macros Sasha Levin
2012-04-14 21:02 ` Peter Zijlstra
2012-04-14 21:18 ` Srivatsa S. Bhat
2012-04-14 22:31   ` Srivatsa S. Bhat
2012-04-14 22:14 ` [RFC 1/3] typecheck: extend typecheck.h with more useful typechecking macros Sasha Levin
2012-04-14 21:12   ` Linus Torvalds
2012-04-14 22:14 ` [RFC 2/3] sched: add type checks to for_each_cpu_mask() Sasha Levin
2012-04-14 21:15   ` Linus Torvalds
2012-04-20 22:33   ` Andrew Morton [this message]
2012-04-14 22:14 ` [RFC 3/3] kernel.h: use new typechecking macros in min()/max() and friends Sasha Levin
2012-04-14 21:01   ` Peter Zijlstra
2012-04-14 21:17   ` Linus Torvalds

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120420153351.53085ed9.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=hpa@zytor.com \
    --cc=levinsasha928@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    --cc=srivatsa.bhat@linux.vnet.ibm.com \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.