Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/ic Cast to uint32_t to avoid undefined behavior in d...
details: https://anonhg.NetBSD.org/src/rev/06740e4885ee
branches: trunk
changeset: 1021164:06740e4885ee
user: msaitoh <msaitoh%NetBSD.org@localhost>
date: Thu May 13 05:56:39 2021 +0000
description:
Cast to uint32_t to avoid undefined behavior in dwc_gmac_write_hwaddr().
Found by kUBSan.
diffstat:
sys/dev/ic/dwc_gmac.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diffs (27 lines):
diff -r 53d34b9bdd80 -r 06740e4885ee sys/dev/ic/dwc_gmac.c
--- a/sys/dev/ic/dwc_gmac.c Thu May 13 05:54:14 2021 +0000
+++ b/sys/dev/ic/dwc_gmac.c Thu May 13 05:56:39 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_gmac.c,v 1.72 2020/12/31 15:09:12 ryo Exp $ */
+/* $NetBSD: dwc_gmac.c,v 1.73 2021/05/13 05:56:39 msaitoh Exp $ */
/*-
* Copyright (c) 2013, 2014 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.72 2020/12/31 15:09:12 ryo Exp $");
+__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.73 2021/05/13 05:56:39 msaitoh Exp $");
/* #define DWC_GMAC_DEBUG 1 */
@@ -398,7 +398,7 @@
hi = enaddr[4] | (enaddr[5] << 8);
lo = enaddr[0] | (enaddr[1] << 8) | (enaddr[2] << 16)
- | (enaddr[3] << 24);
+ | ((uint32_t)enaddr[3] << 24);
bus_space_write_4(sc->sc_bst, sc->sc_bsh, AWIN_GMAC_MAC_ADDR0HI, hi);
bus_space_write_4(sc->sc_bst, sc->sc_bsh, AWIN_GMAC_MAC_ADDR0LO, lo);
}
Home |
Main Index |
Thread Index |
Old Index