Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/ddb enums might be unsigned.



details:   https://anonhg.NetBSD.org/src/rev/dcd3e49210a3
branches:  trunk
changeset: 320932:dcd3e49210a3
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Mon Mar 05 07:47:21 2018 +0000

description:
enums might be unsigned.

diffstat:

 sys/ddb/db_autoconf.c |  11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diffs (34 lines):

diff -r 302186bbb71d -r dcd3e49210a3 sys/ddb/db_autoconf.c
--- a/sys/ddb/db_autoconf.c     Mon Mar 05 07:03:27 2018 +0000
+++ b/sys/ddb/db_autoconf.c     Mon Mar 05 07:47:21 2018 +0000
@@ -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 @@
        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);



Home | Main Index | Thread Index | Old Index