Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/pci Use unsigned to avoid undefined behavior. Found ...
details: https://anonhg.NetBSD.org/src/rev/767a87b58e09
branches: trunk
changeset: 1008024:767a87b58e09
user: msaitoh <msaitoh%NetBSD.org@localhost>
date: Sun Mar 08 14:10:24 2020 +0000
description:
Use unsigned to avoid undefined behavior. Found by kUBSan.
diffstat:
sys/dev/pci/if_nfe.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diffs (41 lines):
diff -r 504b31f0e0e0 -r 767a87b58e09 sys/dev/pci/if_nfe.c
--- a/sys/dev/pci/if_nfe.c Sun Mar 08 14:09:32 2020 +0000
+++ b/sys/dev/pci/if_nfe.c Sun Mar 08 14:10:24 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_nfe.c,v 1.76 2020/03/01 16:31:01 thorpej Exp $ */
+/* $NetBSD: if_nfe.c,v 1.77 2020/03/08 14:10:24 msaitoh Exp $ */
/* $OpenBSD: if_nfe.c,v 1.77 2008/02/05 16:52:50 brad Exp $ */
/*-
@@ -21,7 +21,7 @@
/* Driver for NVIDIA nForce MCP Fast Ethernet and Gigabit Ethernet */
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_nfe.c,v 1.76 2020/03/01 16:31:01 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_nfe.c,v 1.77 2020/03/08 14:10:24 msaitoh Exp $");
#include "opt_inet.h"
#include "vlan.h"
@@ -1924,11 +1924,11 @@
addr[0] |= 0x01; /* make sure multicast bit is set */
NFE_WRITE(sc, NFE_MULTIADDR_HI,
- addr[3] << 24 | addr[2] << 16 | addr[1] << 8 | addr[0]);
+ (uint32_t)addr[3] << 24 | addr[2] << 16 | addr[1] << 8 | addr[0]);
NFE_WRITE(sc, NFE_MULTIADDR_LO,
addr[5] << 8 | addr[4]);
NFE_WRITE(sc, NFE_MULTIMASK_HI,
- mask[3] << 24 | mask[2] << 16 | mask[1] << 8 | mask[0]);
+ (uint32_t)mask[3] << 24 | mask[2] << 16 | mask[1] << 8 | mask[0]);
NFE_WRITE(sc, NFE_MULTIMASK_LO,
mask[5] << 8 | mask[4]);
@@ -1971,7 +1971,7 @@
NFE_WRITE(sc, NFE_MACADDR_LO,
addr[5] << 8 | addr[4]);
NFE_WRITE(sc, NFE_MACADDR_HI,
- addr[3] << 24 | addr[2] << 16 | addr[1] << 8 | addr[0]);
+ (uint32_t)addr[3] << 24 | addr[2] << 16 | addr[1] << 8 | addr[0]);
}
void
Home |
Main Index |
Thread Index |
Old Index