Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=5cf9f062c8e33d5a09eaa447550330162b2a96ed
Commit:     5cf9f062c8e33d5a09eaa447550330162b2a96ed
Parent:     0dbee3a6b006dbe814d002cb18e94bf24a216451
Author:     Milton Miller <[EMAIL PROTECTED]>
AuthorDate: Mon Oct 15 17:00:19 2007 +0200
Committer:  Ingo Molnar <[EMAIL PROTECTED]>
CommitDate: Mon Oct 15 17:00:19 2007 +0200

    sched: domain sysctl fixes: use kcalloc()
    
    kcalloc checks for n * sizeof(element) overflows and it zeros.
    
    Signed-off-by: Milton Miller <[EMAIL PROTECTED]>
    Signed-off-by: Ingo Molnar <[EMAIL PROTECTED]>
---
 kernel/sched.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/kernel/sched.c b/kernel/sched.c
index 7506127..d29950a 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -5243,10 +5243,9 @@ static struct ctl_table sd_ctl_root[] = {
 static struct ctl_table *sd_alloc_ctl_entry(int n)
 {
        struct ctl_table *entry =
-               kmalloc(n * sizeof(struct ctl_table), GFP_KERNEL);
+               kcalloc(n, sizeof(struct ctl_table), GFP_KERNEL);
 
        BUG_ON(!entry);
-       memset(entry, 0, n * sizeof(struct ctl_table));
 
        return entry;
 }
@@ -6018,7 +6017,7 @@ static int build_sched_domains(const cpumask_t *cpu_map)
        /*
         * Allocate the per-node list of sched groups
         */
-       sched_group_nodes = kzalloc(sizeof(struct sched_group *)*MAX_NUMNODES,
+       sched_group_nodes = kcalloc(MAX_NUMNODES, sizeof(struct sched_group *),
                                           GFP_KERNEL);
        if (!sched_group_nodes) {
                printk(KERN_WARNING "Can not alloc sched group node list\n");
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to