cpumask: remove definition of struct cpumask when CONFIG_CPUMASK_OFFSTACK=y

By removing the definition, we ensure that noone can ever assign it, or
declare one on the stack.  This is important as CONFIG_CPUMASK_OFFSTACK=y
will allocate nr_cpu_ids bit arrays, not NR_CPUS.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
---
 include/linux/cpumask.h |   14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -145,9 +145,18 @@ typedef struct cpumask { DECLARE_BITMAP(
 typedef struct cpumask { DECLARE_BITMAP(bits, NR_CPUS); } cpumask_t;
 extern cpumask_t _unused_cpumask_arg_;
 #else
+
+#ifdef CONFIG_CPUMASK_OFFSTACK
+/*
+ * This is never declared, so you can't accidentally create one (see
+ * cpumask_var_t) or copy them by assignment (see cpumask_copy).
+ */
+struct cpumask;
+#else
 struct cpumask {
 	DECLARE_BITMAP(_bits, CONFIG_NR_CPUS);
 };
+#endif /* CONFIG_CPUMASK_OFFSTACK */
 #endif /* CONFIG_DISABLE_CPUMASK_TYPEDEF */
 
 #ifndef CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS
@@ -522,7 +531,10 @@ extern struct cpumask *_cpu_active_mask_
 /* These are the new versions of the cpumask operators: passed by pointer.
  * The older versions will be implemented in terms of these, then deleted. */
 #ifdef CONFIG_DISABLE_CPUMASK_TYPEDEF
-#define cpumask_bits(maskp) ((maskp)->_bits)
+static inline unsigned long *cpumask_bits(const struct cpumask *mask)
+{
+	return (unsigned long *)mask;
+}
 #else
 #define cpumask_bits(maskp) ((maskp)->bits)
 #endif
