Use unsigned. Found by UBSan. OK'd by kamil.

This commit is contained in:
msaitoh 2019-06-07 04:39:15 +00:00
parent 3b2a0061ea
commit 371f8c0bbf
2 changed files with 15 additions and 15 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_wm.c,v 1.639 2019/05/28 08:59:35 msaitoh Exp $ */
/* $NetBSD: if_wm.c,v 1.640 2019/06/07 04:39:15 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.639 2019/05/28 08:59:35 msaitoh Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.640 2019/06/07 04:39:15 msaitoh Exp $");
#ifdef _KERNEL_OPT
#include "opt_net_mpsafe.h"
@ -3541,9 +3541,9 @@ wm_set_ral(struct wm_softc *sc, const uint8_t *enaddr, int idx)
int rv;
if (enaddr != NULL) {
ral_lo = enaddr[0] | (enaddr[1] << 8) | (enaddr[2] << 16) |
(enaddr[3] << 24);
ral_hi = enaddr[4] | (enaddr[5] << 8);
ral_lo = (uint32_t)enaddr[0] | ((uint32_t)enaddr[1] << 8) |
((uint32_t)enaddr[2] << 16) | ((uint32_t)enaddr[3] << 24);
ral_hi = (uint32_t)enaddr[4] | ((uint32_t)enaddr[5] << 8);
ral_hi |= RAL_AV;
} else {
ral_lo = 0;
@ -5198,7 +5198,7 @@ wm_init_rss(struct wm_softc *sc)
CTASSERT(sizeof(rss_key) == RSS_KEYSIZE);
for (i = 0; i < RETA_NUM_ENTRIES; i++) {
int qid, reta_ent;
unsigned int qid, reta_ent;
qid = i % sc->sc_nqueues;
switch (sc->sc_type) {
@ -5915,9 +5915,9 @@ wm_init_locked(struct ifnet *ifp)
/* Set registers about MSI-X */
if (wm_is_using_msix(sc)) {
uint32_t ivar;
uint32_t ivar, qintr_idx;
struct wm_queue *wmq;
int qid, qintr_idx;
unsigned int qid;
if (sc->sc_type == WM_T_82575) {
/* Interrupt control */

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_wmreg.h,v 1.113 2019/02/28 16:56:35 khorben Exp $ */
/* $NetBSD: if_wmreg.h,v 1.114 2019/06/07 04:39:15 msaitoh Exp $ */
/*
* Copyright (c) 2001 Wasabi Systems, Inc.
@ -720,17 +720,17 @@ struct livengood_tcpip_ctxdesc {
#define IVAR_VALID __BIT(7)
/* IVAR definitions for 82580 and newer */
#define WMREG_IVAR_Q(x) (WMREG_IVAR0 + ((x) / 2) * 4)
#define IVAR_TX_MASK_Q(x) (0x000000ff << (((x) % 2) == 0 ? 8 : 24))
#define IVAR_RX_MASK_Q(x) (0x000000ff << (((x) % 2) == 0 ? 0 : 16))
#define IVAR_TX_MASK_Q(x) (0x000000ffUL << (((x) % 2) == 0 ? 8 : 24))
#define IVAR_RX_MASK_Q(x) (0x000000ffUL << (((x) % 2) == 0 ? 0 : 16))
/* IVAR definitions for 82576 */
#define WMREG_IVAR_Q_82576(x) (WMREG_IVAR0 + ((x) & 0x7) * 4)
#define IVAR_TX_MASK_Q_82576(x) (0x000000ff << (((x) / 8) == 0 ? 8 : 24))
#define IVAR_RX_MASK_Q_82576(x) (0x000000ff << (((x) / 8) == 0 ? 0 : 16))
#define IVAR_TX_MASK_Q_82576(x) (0x000000ffUL << (((x) / 8) == 0 ? 8 : 24))
#define IVAR_RX_MASK_Q_82576(x) (0x000000ffUL << (((x) / 8) == 0 ? 0 : 16))
/* IVAR definitions for 82574 */
#define IVAR_ALLOC_MASK_82574 __BITS(0, 2)
#define IVAR_VALID_82574 __BIT(3)
#define IVAR_TX_MASK_Q_82574(x) (0x0000000f << ((x) == 0 ? 8 : 12))
#define IVAR_RX_MASK_Q_82574(x) (0x0000000f << ((x) == 0 ? 0 : 4))
#define IVAR_TX_MASK_Q_82574(x) (0x0000000fUL << ((x) == 0 ? 8 : 12))
#define IVAR_RX_MASK_Q_82574(x) (0x0000000fUL << ((x) == 0 ? 0 : 4))
#define IVAR_OTHER_MASK __BITS(16, 19)
#define IVAR_INT_ON_ALL_WB __BIT(31)