diff options
author | Milton Miller <miltonm@bga.com> | 2007-10-15 11:00:19 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2007-10-15 11:00:19 -0400 |
commit | 5cf9f062c8e33d5a09eaa447550330162b2a96ed (patch) | |
tree | 93095cd5531605db4084a5189fef41ef4e36d3cb /kernel | |
parent | 0dbee3a6b006dbe814d002cb18e94bf24a216451 (diff) |
sched: domain sysctl fixes: use kcalloc()
kcalloc checks for n * sizeof(element) overflows and it zeros.
Signed-off-by: Milton Miller <miltonm@bga.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/sched.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/kernel/sched.c b/kernel/sched.c index 750612751a7f..d29950a60411 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -5243,10 +5243,9 @@ static struct ctl_table sd_ctl_root[] = { | |||
5243 | static struct ctl_table *sd_alloc_ctl_entry(int n) | 5243 | static struct ctl_table *sd_alloc_ctl_entry(int n) |
5244 | { | 5244 | { |
5245 | struct ctl_table *entry = | 5245 | struct ctl_table *entry = |
5246 | kmalloc(n * sizeof(struct ctl_table), GFP_KERNEL); | 5246 | kcalloc(n, sizeof(struct ctl_table), GFP_KERNEL); |
5247 | 5247 | ||
5248 | BUG_ON(!entry); | 5248 | BUG_ON(!entry); |
5249 | memset(entry, 0, n * sizeof(struct ctl_table)); | ||
5250 | 5249 | ||
5251 | return entry; | 5250 | return entry; |
5252 | } | 5251 | } |
@@ -6018,7 +6017,7 @@ static int build_sched_domains(const cpumask_t *cpu_map) | |||
6018 | /* | 6017 | /* |
6019 | * Allocate the per-node list of sched groups | 6018 | * Allocate the per-node list of sched groups |
6020 | */ | 6019 | */ |
6021 | sched_group_nodes = kzalloc(sizeof(struct sched_group *)*MAX_NUMNODES, | 6020 | sched_group_nodes = kcalloc(MAX_NUMNODES, sizeof(struct sched_group *), |
6022 | GFP_KERNEL); | 6021 | GFP_KERNEL); |
6023 | if (!sched_group_nodes) { | 6022 | if (!sched_group_nodes) { |
6024 | printk(KERN_WARNING "Can not alloc sched group node list\n"); | 6023 | printk(KERN_WARNING "Can not alloc sched group node list\n"); |