summaryrefslogtreecommitdiff
path: root/sys/dev/dev_verbose.c
diff options
context:
space:
mode:
authorchristos <christos@NetBSD.org>2016-02-03 05:29:43 +0000
committerchristos <christos@NetBSD.org>2016-02-03 05:29:43 +0000
commitea14532ea4e6a2062a98fdc3c599f2e90adedde1 (patch)
treeed956ee930411bd52d19927578ba07b8fe84579e /sys/dev/dev_verbose.c
parent135c7ea51237fadeee05c550adbf2736edaabd5e (diff)
PR/50749: David Binderman: check bounds before dereference.
Diffstat (limited to 'sys/dev/dev_verbose.c')
-rw-r--r--sys/dev/dev_verbose.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/dev/dev_verbose.c b/sys/dev/dev_verbose.c
index 71bf52bcaac..8dedc49f435 100644
--- a/sys/dev/dev_verbose.c
+++ b/sys/dev/dev_verbose.c
@@ -1,4 +1,4 @@
-/* $NetBSD: dev_verbose.c,v 1.1 2014/09/21 14:30:22 christos Exp $ */
+/* $NetBSD: dev_verbose.c,v 1.2 2016/02/03 05:29:43 christos Exp $ */
/*
* Redistribution and use in source and binary forms, with or without
@@ -23,7 +23,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dev_verbose.c,v 1.1 2014/09/21 14:30:22 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dev_verbose.c,v 1.2 2016/02/03 05:29:43 christos Exp $");
#include <sys/param.h>
@@ -65,7 +65,7 @@ dev_findvendor(char *buf, size_t len, const char *words, size_t nwords,
/* Skip Tokens */
n++;
- while (vendors[n] != 0 && n < nvendors)
+ while (n < nvendors && vendors[n] != 0)
n++;
}
snprintf(buf, len, "vendor %4.4x", vendor);
@@ -86,7 +86,7 @@ dev_findproduct(char *buf, size_t len, const char *words, size_t nwords,
/* Skip Tokens */
n += 2;
- while (products[n] != 0 && n < nproducts)
+ while (n < nproducts && products[n] != 0)
n++;
}
snprintf(buf, len, "product %4.4x", product);