aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Certner <olce@FreeBSD.org>2026-03-05 12:31:51 +0000
committerOlivier Certner <olce@FreeBSD.org>2026-03-05 20:40:53 +0000
commit35da55c28dbb56dd7056b7863efc5b547950d885 (patch)
tree72e2c7a99fa17549d7045e3c1985da4d098ed035
parent9cea0f0be79dc080761154cb934db0218ae512f3 (diff)
iwx: Fix 32-bit compilation
- Avoid shifts wider than integer types, by wrapping the corresponding checks into '#if __SIZEOF_SIZE_T__ > 32' blocks. 'bus_addr_t' currently has the same width as 'size_t' on all architectures (and this is not going to change for 32-bit architectures). - Use appropriate printf(3) format for 'wk_keytsc'. Reviewed by: adrian MFC after: 1 minute MFC to: stable/15 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D55667
-rw-r--r--sys/dev/iwx/if_iwx.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/sys/dev/iwx/if_iwx.c b/sys/dev/iwx/if_iwx.c
index 8f11e6a414e7..ea1ba513734a 100644
--- a/sys/dev/iwx/if_iwx.c
+++ b/sys/dev/iwx/if_iwx.c
@@ -155,6 +155,7 @@
#include <sys/epoch.h>
#include <sys/kdb.h>
+#include <machine/_inttypes.h>
#include <machine/bus.h>
#include <machine/endian.h>
#include <machine/resource.h>
@@ -5818,15 +5819,21 @@ iwx_tx(struct iwx_softc *sc, struct mbuf *m, struct ieee80211_node *ni)
desc->tbs[0].tb_len = htole16(IWX_FIRST_TB_SIZE);
paddr = htole64(data->cmd_paddr);
memcpy(&desc->tbs[0].addr, &paddr, sizeof(paddr));
- if (data->cmd_paddr >> 32 != (data->cmd_paddr + le32toh(desc->tbs[0].tb_len)) >> 32)
+#if __SIZEOF_SIZE_T__ > 32
+ if (data->cmd_paddr >> 32 != (data->cmd_paddr +
+ le32toh(desc->tbs[0].tb_len)) >> 32)
DPRINTF(("%s: TB0 crosses 32bit boundary\n", __func__));
+#endif
desc->tbs[1].tb_len = htole16(sizeof(struct iwx_cmd_header) +
txcmd_size + hdrlen + pad - IWX_FIRST_TB_SIZE);
paddr = htole64(data->cmd_paddr + IWX_FIRST_TB_SIZE);
memcpy(&desc->tbs[1].addr, &paddr, sizeof(paddr));
- if (data->cmd_paddr >> 32 != (data->cmd_paddr + le32toh(desc->tbs[1].tb_len)) >> 32)
+#if __SIZEOF_SIZE_T__ > 32
+ if (data->cmd_paddr >> 32 != (data->cmd_paddr +
+ le32toh(desc->tbs[1].tb_len)) >> 32)
DPRINTF(("%s: TB1 crosses 32bit boundary\n", __func__));
+#endif
/* Other DMA segments are for data payload. */
for (i = 0; i < nsegs; i++) {
@@ -5834,8 +5841,12 @@ iwx_tx(struct iwx_softc *sc, struct mbuf *m, struct ieee80211_node *ni)
desc->tbs[i + 2].tb_len = htole16(seg->ds_len);
paddr = htole64(seg->ds_addr);
memcpy(&desc->tbs[i + 2].addr, &paddr, sizeof(paddr));
- if (data->cmd_paddr >> 32 != (data->cmd_paddr + le32toh(desc->tbs[i + 2].tb_len)) >> 32)
- DPRINTF(("%s: TB%d crosses 32bit boundary\n", __func__, i + 2));
+#if __SIZEOF_SIZE_T__ > 32
+ if (data->cmd_paddr >> 32 != (data->cmd_paddr +
+ le32toh(desc->tbs[i + 2].tb_len)) >> 32)
+ DPRINTF(("%s: TB%d crosses 32bit boundary\n", __func__,
+ i + 2));
+#endif
}
bus_dmamap_sync(ring->data_dmat, data->map, BUS_DMASYNC_PREWRITE);
@@ -11079,8 +11090,8 @@ iwx_key_set(struct ieee80211vap *vap, const struct ieee80211_key *k)
cmd.common.sta_id = IWX_STATION_ID;
cmd.transmit_seq_cnt = htole64(k->wk_keytsc);
- IWX_DPRINTF(sc, IWX_DEBUG_KEYMGMT, "%s: k->wk_keytsc=%lu\n", __func__,
- k->wk_keytsc);
+ IWX_DPRINTF(sc, IWX_DEBUG_KEYMGMT, "%s: k->wk_keytsc=%" PRIu64 "\n",
+ __func__, k->wk_keytsc);
status = IWX_ADD_STA_SUCCESS;
err = iwx_send_cmd_pdu_status(sc, IWX_ADD_STA_KEY, sizeof(cmd), &cmd,