Merge branch 'printk-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
[safe/jmp/linux-2.6] / lib / cpumask.c
index a24edf1..1f71b97 100644 (file)
@@ -107,6 +107,14 @@ bool alloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags, int node)
                dump_stack();
        }
 #endif
+       /* FIXME: Bandaid to save us from old primitives which go to NR_CPUS. */
+       if (*mask) {
+               unsigned char *ptr = (unsigned char *)cpumask_bits(*mask);
+               unsigned int tail;
+               tail = BITS_TO_LONGS(NR_CPUS - nr_cpumask_bits) * sizeof(long);
+               memset(ptr + cpumask_size() - tail, 0, tail);
+       }
+
        return *mask != NULL;
 }
 EXPORT_SYMBOL(alloc_cpumask_var_node);
@@ -132,7 +140,7 @@ EXPORT_SYMBOL(alloc_cpumask_var);
  * @mask: pointer to cpumask_var_t where the cpumask is returned
  *
  * Only defined when CONFIG_CPUMASK_OFFSTACK=y, otherwise is
- * a nop returning a constant 1 (in <linux/cpumask.h>)
+ * a nop (in <linux/cpumask.h>).
  * Either returns an allocated (zero-filled) cpumask, or causes the
  * system to panic.
  */