Re: [PATCH -tip/cpus4096-v2] cpumask: fix cpumask

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Rusty Russell
Date: Monday, October 27, 2008 - 5:46 pm

On Tuesday 28 October 2008 10:07:26 Hiroshi Shimamoto wrote:

Yes.  This is another one.

Ingo, please fold.

Subject: Fix slab corruption when using CONFIG_CPUMASK_OFFSTACK

Found by Hiroshi Shimamoto; using assignment on a cpumask_t causes slab
corruption, as we do not allocate sizeof(struct cpumask).

It looks like we will have to stick with allocating all NR_CPUS bits until the
end of the patchset (in the future) where we have eliminated all the
cpumask_t assignments.

(Note: this ban will be enforced by compiler when we get rid of the 'struct
cpumask' definition, which is what we're slowly working towards).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
index d1f22ee..004da56 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -182,7 +182,8 @@ int cpumask_any_but(const struct cpumask *mask, unsigned int cpu);
 
 static inline size_t cpumask_size(void)
 {
-	return BITS_TO_LONGS(nr_cpumask_bits) * sizeof(long);
+	/* FIXME: Use nr_cpumask_bits once all cpumask_t assignments banished */
+	return BITS_TO_LONGS(NR_CPUS) * sizeof(long);
 }
 
 /* Deprecated. */

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH -tip/cpus4096-v2] cpumask: fix cpumask of call_func ..., Hiroshi Shimamoto, (Thu Oct 23, 9:47 pm)
Re: [PATCH -tip/cpus4096-v2] cpumask: fix cpumask of call_ ..., Hiroshi Shimamoto, (Fri Oct 24, 2:46 pm)
Re: [PATCH -tip/cpus4096-v2] cpumask: fix cpumask of call_ ..., Hiroshi Shimamoto, (Mon Oct 27, 4:07 pm)
Re: [PATCH -tip/cpus4096-v2] cpumask: fix cpumask , Rusty Russell, (Mon Oct 27, 5:46 pm)
Re: [PATCH -tip/cpus4096-v2] cpumask: fix cpumask of call_ ..., Hiroshi Shimamoto, (Thu Oct 30, 10:44 am)