aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2022-11-29 01:08:09 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2022-11-29 01:08:09 +0000
commite7cd5ffff88f1f4dfba2693041cc78fcf3613fba (patch)
treee07f0edae99605bac11ee79fd4cc9399f38d8e10
parent0acf696151e3c43967988c8271aa27683566a755 (diff)
downloadsrc-e7cd5ffff88f1f4dfba2693041cc78fcf3613fba.tar.gz
src-e7cd5ffff88f1f4dfba2693041cc78fcf3613fba.zip
bhyve: Fix sign compare warnings in the e1000 device model.
Adding a bare constant to a uint16_t promotes to a signed int which triggers these warnings. Changing the constant to be explicitly unsigned instead promotes the expression to unsigned int. Reviewed by: corvink, markj Differential Revision: https://reviews.freebsd.org/D37485
-rw-r--r--usr.sbin/bhyve/pci_e82545.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/usr.sbin/bhyve/pci_e82545.c b/usr.sbin/bhyve/pci_e82545.c
index 21e01b22ec4b..9d991b124965 100644
--- a/usr.sbin/bhyve/pci_e82545.c
+++ b/usr.sbin/bhyve/pci_e82545.c
@@ -1045,7 +1045,7 @@ e82545_transmit_checksum(struct iovec *iov, int iovcnt, struct ck_info *ck)
DPRINTF("tx cksum: iovcnt/s/off/len %d/%d/%d/%d",
iovcnt, ck->ck_start, ck->ck_off, ck->ck_len);
- cklen = ck->ck_len ? ck->ck_len - ck->ck_start + 1 : UINT_MAX;
+ cklen = ck->ck_len ? ck->ck_len - ck->ck_start + 1U : UINT_MAX;
cksum = e82545_iov_checksum(iov, iovcnt, ck->ck_start, cklen);
*(uint16_t *)((uint8_t *)iov[0].iov_base + ck->ck_off) = ~cksum;
}
@@ -1231,9 +1231,9 @@ e82545_transmit(struct e82545_softc *sc, uint16_t head, uint16_t tail,
if (!tso) {
/* Estimate required writable space for checksums. */
if (ckinfo[0].ck_valid)
- hdrlen = MAX(hdrlen, ckinfo[0].ck_off + 2);
+ hdrlen = MAX(hdrlen, ckinfo[0].ck_off + 2U);
if (ckinfo[1].ck_valid)
- hdrlen = MAX(hdrlen, ckinfo[1].ck_off + 2);
+ hdrlen = MAX(hdrlen, ckinfo[1].ck_off + 2U);
/* Round up writable space to the first vector. */
if (hdrlen != 0 && iov[0].iov_len > hdrlen &&
iov[0].iov_len < hdrlen + 100)
@@ -1282,26 +1282,26 @@ e82545_transmit(struct e82545_softc *sc, uint16_t head, uint16_t tail,
* TCP | flags | 13 | 1
* UDP | len | 4 | 4
*/
- if (hdrlen < ckinfo[0].ck_start + 6 ||
- hdrlen < ckinfo[0].ck_off + 2) {
+ if (hdrlen < ckinfo[0].ck_start + 6U ||
+ hdrlen < ckinfo[0].ck_off + 2U) {
WPRINTF("TSO hdrlen too small for IP fields (%d) "
"-- dropped", hdrlen);
goto done;
}
if (sc->esc_txctx.cmd_and_length & E1000_TXD_CMD_TCP) {
- if (hdrlen < ckinfo[1].ck_start + 14) {
+ if (hdrlen < ckinfo[1].ck_start + 14U) {
WPRINTF("TSO hdrlen too small for TCP fields "
"(%d) -- dropped", hdrlen);
goto done;
}
} else {
- if (hdrlen < ckinfo[1].ck_start + 8) {
+ if (hdrlen < ckinfo[1].ck_start + 8U) {
WPRINTF("TSO hdrlen too small for UDP fields "
"(%d) -- dropped", hdrlen);
goto done;
}
}
- if (ckinfo[1].ck_valid && hdrlen < ckinfo[1].ck_off + 2) {
+ if (ckinfo[1].ck_valid && hdrlen < ckinfo[1].ck_off + 2U) {
WPRINTF("TSO hdrlen too small for TCP/UDP fields "
"(%d) -- dropped", hdrlen);
goto done;