tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Signed vs unsigned comparisons in sys/dev/pcio/if_wm.c
While starting to investigate the possibility of modularizing the
if_wm(4) driver, I discovered some issues where signed expressions are
being compared to unsigned expressions. When if_wm.c is being compiled
as a built-in driver, these errors are ignored. However, when build as
a loadable module, they are fatal to the build!
There are three instances within if_wm.c where this occurs, at source
lines 6164, 6688, and 9204 (based on revision 1.443). The attached
diffs make the compiler happy in both cases (kernel and module).
Is there any reason why these changes should not be committed?
+------------------+--------------------------+------------------------+
| Paul Goyette | PGP Key fingerprint: | E-mail addresses: |
| (Retired) | FA29 0E3B 35AF E8AE 6651 | paul at whooppee.com |
| Kernel Developer | 0786 F758 55DE 53BA 7731 | pgoyette at netbsd.org |
+------------------+--------------------------+------------------------+
Index: if_wm.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/if_wm.c,v
retrieving revision 1.443
diff -u -p -r1.443 if_wm.c
--- if_wm.c 10 Nov 2016 08:35:24 -0000 1.443
+++ if_wm.c 13 Nov 2016 01:28:45 -0000
@@ -438,7 +438,7 @@ struct wm_softc {
int sc_funcid; /* unit number of the chip (0 to 3) */
int sc_flags; /* flags; see below */
int sc_if_flags; /* last if_flags */
- int sc_flowflags; /* 802.3x flow control flags */
+ unsigned int sc_flowflags; /* 802.3x flow control flags */
int sc_align_tweak;
void *sc_ihs[WM_MAX_NINTR]; /*
@@ -6162,7 +6162,7 @@ wm_tx_offload(struct wm_softc *sc, struc
bool v4 = (m0->m_pkthdr.csum_flags & M_CSUM_TSOv4) != 0;
if (__predict_false(m0->m_len <
- (hlen + sizeof(struct tcphdr)))) {
+ (hlen + (int)sizeof(struct tcphdr)))) {
/*
* TCP/IP headers are not in the first mbuf; we need
* to do this the slow and painful way. Let's just
@@ -6686,7 +6686,7 @@ wm_nq_tx_offload(struct wm_softc *sc, st
bool v4 = (m0->m_pkthdr.csum_flags & M_CSUM_TSOv4) != 0;
if (__predict_false(m0->m_len <
- (hlen + sizeof(struct tcphdr)))) {
+ (hlen + (int)sizeof(struct tcphdr)))) {
/*
* TCP/IP headers are not in the first mbuf; we need
* to do this the slow and painful way. Let's just
Home |
Main Index |
Thread Index |
Old Index