From 74a027085618c1d096c2532f2a751acc01eea0a4 Mon Sep 17 00:00:00 2001 From: xtraeme Date: Fri, 1 Feb 2008 23:12:30 +0000 Subject: [PATCH] aiboost_getcomp: use Package.Count to allocate and iterate over the elements rather than Integer.Value, which sometimes doesn't match and gives unexpected results on the error path. This fixes the kmem_poison_check on DEBUG kernels (finally). Patch by Fukumoto Atsushi. Thanks! --- sys/dev/acpi/aiboost.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/dev/acpi/aiboost.c b/sys/dev/acpi/aiboost.c index fd9a91608cf2..babfd07a1241 100644 --- a/sys/dev/acpi/aiboost.c +++ b/sys/dev/acpi/aiboost.c @@ -1,4 +1,4 @@ -/* $NetBSD: aiboost.c,v 1.21 2008/01/29 19:35:05 xtraeme Exp $ */ +/* $NetBSD: aiboost.c,v 1.22 2008/02/01 23:12:30 xtraeme Exp $ */ /*- * Copyright (c) 2007 Juan Romero Pardines @@ -28,7 +28,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: aiboost.c,v 1.21 2008/01/29 19:35:05 xtraeme Exp $"); +__KERNEL_RCSID(0, "$NetBSD: aiboost.c,v 1.22 2008/02/01 23:12:30 xtraeme Exp $"); #include #include @@ -333,13 +333,13 @@ aiboost_getcomp(ACPI_HANDLE *h, const char *name, struct aiboost_comp **comp) } clen = sizeof(struct aiboost_comp) + sizeof(struct aiboost_elem) * - (elem->Integer.Value - 1); + (o->Package.Count - 1); c = kmem_zalloc(clen, KM_NOSLEEP); if (!c) goto error; *comp = c; - c->num = elem->Integer.Value; + c->num = o->Package.Count - 1; for (i = 1; i < o->Package.Count; i++) { elem = &o->Package.Elements[i];