Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern cpu_infos is a NULL terminated array, not an array ...



details:   https://anonhg.NetBSD.org/src/rev/7a1539768db7
branches:  trunk
changeset: 792092:7a1539768db7
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Thu Dec 19 23:36:07 2013 +0000

description:
cpu_infos is a NULL terminated array, not an array followed by a 0 byte.

diffstat:

 sys/kern/kern_cpu.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (29 lines):

diff -r 30327fd4c87a -r 7a1539768db7 sys/kern/kern_cpu.c
--- a/sys/kern/kern_cpu.c       Thu Dec 19 23:00:50 2013 +0000
+++ b/sys/kern/kern_cpu.c       Thu Dec 19 23:36:07 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_cpu.c,v 1.61 2013/11/24 21:58:38 rmind Exp $      */
+/*     $NetBSD: kern_cpu.c,v 1.62 2013/12/19 23:36:07 mlelstv Exp $    */
 
 /*-
  * Copyright (c) 2007, 2008, 2009, 2010, 2012 The NetBSD Foundation, Inc.
@@ -56,7 +56,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_cpu.c,v 1.61 2013/11/24 21:58:38 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_cpu.c,v 1.62 2013/12/19 23:36:07 mlelstv Exp $");
 
 #include "opt_cpu_ucode.h"
 #include "opt_compat_netbsd.h"
@@ -159,8 +159,8 @@
            cpu_index(ci));
 
        if (__predict_false(cpu_infos == NULL)) {
-               size_t nslots = maxcpus * sizeof(struct cpu_info *) + 1;
-               cpu_infos = kmem_zalloc(nslots, KM_SLEEP);
+               size_t ci_bufsize = (maxcpus + 1) * sizeof(struct cpu_info *);
+               cpu_infos = kmem_zalloc(ci_bufsize, KM_SLEEP);
        }
        cpu_infos[cpu_index(ci)] = ci;
 



Home | Main Index | Thread Index | Old Index