Module Name:    src
Committed By:   mlelstv
Date:           Mon Mar  5 07:47:21 UTC 2018

Modified Files:
        src/sys/ddb: db_autoconf.c

Log Message:
enums might be unsigned.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/ddb/db_autoconf.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/ddb/db_autoconf.c
diff -u src/sys/ddb/db_autoconf.c:1.1 src/sys/ddb/db_autoconf.c:1.2
--- src/sys/ddb/db_autoconf.c:1.1	Sun Mar  4 07:14:50 2018
+++ src/sys/ddb/db_autoconf.c	Mon Mar  5 07:47:21 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_autoconf.c,v 1.1 2018/03/04 07:14:50 mlelstv Exp $	*/
+/*	$NetBSD: db_autoconf.c,v 1.2 2018/03/05 07:47:21 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_autoconf.c,v 1.1 2018/03/04 07:14:50 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_autoconf.c,v 1.2 2018/03/05 07:47:21 mlelstv Exp $");
 
 #ifndef _KERNEL
 #include <stdbool.h>
@@ -73,11 +73,12 @@ db_show_all_devices(db_expr_t addr, bool
 	for (dv = db_device_first(); dv != NULL; dv = db_device_next(dv)) {
 		db_read_bytes((db_addr_t)dv, sizeof(buf), (char *)&buf);
 
-		if (buf.dv_class < 0 ||
-		    buf.dv_class > __arraycount(classnames))
+		unsigned i = buf.dv_class;
+
+		if (i >= __arraycount(classnames))
 			cl = "????";
 		else
-			cl = classnames[buf.dv_class];
+			cl = classnames[i];
 
 		db_printf("%-16.16s", buf.dv_xname);
 		db_printf(" %10s", cl);

Reply via email to