From c3b4df92450f734f39449b31a415043141bb151f Mon Sep 17 00:00:00 2001 From: KOSAKI Motohiro Date: Tue, 26 Jul 2011 16:08:45 -0700 Subject: [PATCH] --- yaml --- r: 260422 b: refs/heads/master c: a64a26e822ddb739de464540dfd2cbb6abce47d5 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/include/linux/cpumask.h | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index 88cf4d7e57a2..bae1327e9923 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 37e7b5f1535dddaace865b25df34a2d049a3a66f +refs/heads/master: a64a26e822ddb739de464540dfd2cbb6abce47d5 diff --git a/trunk/include/linux/cpumask.h b/trunk/include/linux/cpumask.h index b24ac56477b4..4f7a63237471 100644 --- a/trunk/include/linux/cpumask.h +++ b/trunk/include/linux/cpumask.h @@ -617,6 +617,20 @@ static inline size_t cpumask_size(void) * ... use 'tmpmask' like a normal struct cpumask * ... * * free_cpumask_var(tmpmask); + * + * + * However, one notable exception is there. alloc_cpumask_var() allocates + * only nr_cpumask_bits bits (in the other hand, real cpumask_t always has + * NR_CPUS bits). Therefore you don't have to dereference cpumask_var_t. + * + * cpumask_var_t tmpmask; + * if (!alloc_cpumask_var(&tmpmask, GFP_KERNEL)) + * return -ENOMEM; + * + * var = *tmpmask; + * + * This code makes NR_CPUS length memcopy and brings to a memory corruption. + * cpumask_copy() provide safe copy functionality. */ #ifdef CONFIG_CPUMASK_OFFSTACK typedef struct cpumask *cpumask_var_t;