diff options
-rw-r--r-- | include/linux/cpumask.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h index b24ac56477b4..4f7a63237471 100644 --- a/include/linux/cpumask.h +++ b/include/linux/cpumask.h | |||
@@ -617,6 +617,20 @@ static inline size_t cpumask_size(void) | |||
617 | * ... use 'tmpmask' like a normal struct cpumask * ... | 617 | * ... use 'tmpmask' like a normal struct cpumask * ... |
618 | * | 618 | * |
619 | * free_cpumask_var(tmpmask); | 619 | * free_cpumask_var(tmpmask); |
620 | * | ||
621 | * | ||
622 | * However, one notable exception is there. alloc_cpumask_var() allocates | ||
623 | * only nr_cpumask_bits bits (in the other hand, real cpumask_t always has | ||
624 | * NR_CPUS bits). Therefore you don't have to dereference cpumask_var_t. | ||
625 | * | ||
626 | * cpumask_var_t tmpmask; | ||
627 | * if (!alloc_cpumask_var(&tmpmask, GFP_KERNEL)) | ||
628 | * return -ENOMEM; | ||
629 | * | ||
630 | * var = *tmpmask; | ||
631 | * | ||
632 | * This code makes NR_CPUS length memcopy and brings to a memory corruption. | ||
633 | * cpumask_copy() provide safe copy functionality. | ||
620 | */ | 634 | */ |
621 | #ifdef CONFIG_CPUMASK_OFFSTACK | 635 | #ifdef CONFIG_CPUMASK_OFFSTACK |
622 | typedef struct cpumask *cpumask_var_t; | 636 | typedef struct cpumask *cpumask_var_t; |