summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authormiod <miod@openbsd.org>2015-06-25 18:08:53 +0000
committermiod <miod@openbsd.org>2015-06-25 18:08:53 +0000
commitc16de97916f202751bdece1e7da35c270d8c316b (patch)
tree5dc4fc6faf7dedd9c818a066d995df0900d779c7 /sys
parentuse machine_architecture (arch -s) when assembling PKG_PATHs using %m or %a, (diff)
downloadwireguard-openbsd-c16de97916f202751bdece1e7da35c270d8c316b.tar.xz
wireguard-openbsd-c16de97916f202751bdece1e7da35c270d8c316b.zip
OF_getprop() returns an int, so comparing its return value against sizeof casts
it to unsigned, and we need to also check for negative values. All users of OF_getprop() did this but that one. ok mpi@
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/macppc/pci/ht.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/arch/macppc/pci/ht.c b/sys/arch/macppc/pci/ht.c
index 38e6012e929..996e51d040d 100644
--- a/sys/arch/macppc/pci/ht.c
+++ b/sys/arch/macppc/pci/ht.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ht.c,v 1.16 2013/08/07 07:29:19 mpi Exp $ */
+/* $OpenBSD: ht.c,v 1.17 2015/06/25 18:08:53 miod Exp $ */
/*
* Copyright (c) 2005 Mark Kettenis
@@ -84,7 +84,7 @@ ht_attach(struct device *parent, struct device *self, void *aux)
}
len = OF_getprop(ca->ca_node, "reg", regs, sizeof(regs));
- if (len < sizeof(regs)) {
+ if (len < 0 || len < sizeof(regs)) {
printf(": regs lookup failed, node %x\n", ca->ca_node);
return;
}