Module Name: src Committed By: mlelstv Date: Thu Dec 19 23:36:07 UTC 2013
Modified Files: src/sys/kern: kern_cpu.c Log Message: cpu_infos is a NULL terminated array, not an array followed by a 0 byte. To generate a diff of this commit: cvs rdiff -u -r1.61 -r1.62 src/sys/kern/kern_cpu.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/kern/kern_cpu.c diff -u src/sys/kern/kern_cpu.c:1.61 src/sys/kern/kern_cpu.c:1.62 --- src/sys/kern/kern_cpu.c:1.61 Sun Nov 24 21:58:38 2013 +++ src/sys/kern/kern_cpu.c Thu Dec 19 23:36:07 2013 @@ -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 @@ mi_cpu_attach(struct cpu_info *ci) 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;