Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/acpi Verify the object type before using variables f...
details: https://anonhg.NetBSD.org/src/rev/e71a00969dc4
branches: trunk
changeset: 751323:e71a00969dc4
user: jruoho <jruoho%NetBSD.org@localhost>
date: Sun Jan 31 20:38:11 2010 +0000
description:
Verify the object type before using variables from it.
In addition, use CTASSERT(9) instead of KASSERT(9).
diffstat:
sys/dev/acpi/wmi_acpi.c | 14 +++++++++-----
1 files changed, 9 insertions(+), 5 deletions(-)
diffs (42 lines):
diff -r 9ed4fa65eaba -r e71a00969dc4 sys/dev/acpi/wmi_acpi.c
--- a/sys/dev/acpi/wmi_acpi.c Sun Jan 31 19:56:19 2010 +0000
+++ b/sys/dev/acpi/wmi_acpi.c Sun Jan 31 20:38:11 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: wmi_acpi.c,v 1.11 2010/01/23 13:32:45 jruoho Exp $ */
+/* $NetBSD: wmi_acpi.c,v 1.12 2010/01/31 20:38:11 jruoho Exp $ */
/*-
* Copyright (c) 2009, 2010 Jukka Ruohonen <jruohonen%iki.fi@localhost>
@@ -27,7 +27,7 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wmi_acpi.c,v 1.11 2010/01/23 13:32:45 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wmi_acpi.c,v 1.12 2010/01/31 20:38:11 jruoho Exp $");
#include <sys/param.h>
#include <sys/device.h>
@@ -209,16 +209,20 @@
goto fail;
obj = buf.Pointer;
- len = obj->Buffer.Length;
- KASSERT(obj->Type == ACPI_TYPE_BUFFER);
+ if (obj->Type != ACPI_TYPE_BUFFER) {
+ rv = AE_TYPE;
+ goto fail;
+ }
+
+ len = obj->Buffer.Length;
if (len != obj->Package.Count) {
rv = AE_BAD_VALUE;
goto fail;
}
- KASSERT(sizeof(struct guid_t) == 20);
+ CTASSERT(sizeof(struct guid_t) == 20);
if (len < sizeof(struct guid_t) ||
len % sizeof(struct guid_t) != 0) {
Home |
Main Index |
Thread Index |
Old Index