Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci Explicitly cast from uint16_t to uint32_t before...



details:   https://anonhg.NetBSD.org/src/rev/96bf1bf73bfd
branches:  trunk
changeset: 937006:96bf1bf73bfd
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Wed Aug 05 01:58:42 2020 +0000

description:
Explicitly cast from uint16_t to uint32_t before shifting 16bit left
when printing Image Unique ID. Found by kUBSan.

diffstat:

 sys/dev/pci/if_wm.c |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (28 lines):

diff -r dfce64868729 -r 96bf1bf73bfd sys/dev/pci/if_wm.c
--- a/sys/dev/pci/if_wm.c       Wed Aug 05 01:35:18 2020 +0000
+++ b/sys/dev/pci/if_wm.c       Wed Aug 05 01:58:42 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_wm.c,v 1.683 2020/08/03 10:52:08 msaitoh Exp $      */
+/*     $NetBSD: if_wm.c,v 1.684 2020/08/05 01:58:42 msaitoh Exp $      */
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -82,7 +82,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.683 2020/08/03 10:52:08 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.684 2020/08/05 01:58:42 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -13947,7 +13947,8 @@
        }
 
        if (have_uid && (wm_nvm_read(sc, NVM_OFF_IMAGE_UID0, 1, &uid0) == 0))
-               aprint_verbose(", Image Unique ID %08x", (uid1 << 16) | uid0);
+               aprint_verbose(", Image Unique ID %08x",
+                   ((uint32_t)uid1 << 16) | uid0);
 }
 
 /*



Home | Main Index | Thread Index | Old Index