From: Kirill A. Korinsky Subject: sys/iwx: removed dead code by Coverity scan report To: OpenBSD tech Date: Mon, 27 Apr 2026 18:15:48 +0200 tech@, daniel@ forwarded to me a coverity scan report which highligh a now dead code from one of the last commit to iwx made by me. I had discovered one more the same pattern in iwx. max_aggsize in both removed conditions are 7 or 9 because of 8247 #define IWX_STA_FLG_MAX_AGG_SIZE_SHIFT 19 ... 8255 #define IWX_STA_FLG_MAX_AGG_SIZE_1024K (7 << IWX_STA_FLG_MAX_AGG_SIZE_SHIFT) ... 8257 #define IWX_STA_FLG_MAX_AGG_SIZE_4M (9 << IWX_STA_FLG_MAX_AGG_SIZE_SHIFT) and maximal possible value for aggsize is less than 7: 6896 aggsize = (in->in_ni.ni_vhtcaps & 6897 IEEE80211_VHTCAP_MAX_AMPDU_LEN_MASK) >> 6898 IEEE80211_VHTCAP_MAX_AMPDU_LEN_SHIFT; 6899 } else { 6900 aggsize = (in->in_ni.ni_ampdu_param & 6901 IEEE80211_AMPDU_PARAM_LE); 6902 } where: 625 #define IEEE80211_AMPDU_PARAM_LE 0x03 ... 779 #define IEEE80211_VHTCAP_MAX_AMPDU_LEN_MASK 0x03800000 780 #define IEEE80211_VHTCAP_MAX_AMPDU_LEN_SHIFT 23 Ok? Index: sys/dev/pci/if_iwx.c =================================================================== RCS file: /home/cvs/src/sys/dev/pci/if_iwx.c,v diff -u -p -r1.228 if_iwx.c --- sys/dev/pci/if_iwx.c 2 Apr 2026 11:19:45 -0000 1.228 +++ sys/dev/pci/if_iwx.c 27 Apr 2026 13:18:36 -0000 @@ -6726,8 +6726,6 @@ iwx_add_sta_cmd(struct iwx_softc *sc, st struct iwx_add_sta_cmd add_sta_cmd; int err; uint32_t status, aggsize; - const uint32_t max_aggsize = (IWX_STA_FLG_MAX_AGG_SIZE_1024K >> - IWX_STA_FLG_MAX_AGG_SIZE_SHIFT); struct ieee80211com *ic = &sc->sc_ic; if (!update && (sc->sc_flags & IWX_FLAG_STA_ACTIVE)) @@ -6808,8 +6806,6 @@ iwx_add_sta_cmd(struct iwx_softc *sc, st aggsize = (in->in_ni.ni_ampdu_param & IEEE80211_AMPDU_PARAM_LE); } - if (aggsize > max_aggsize) - aggsize = max_aggsize; add_sta_cmd.station_flags |= htole32((aggsize << IWX_STA_FLG_MAX_AGG_SIZE_SHIFT) & IWX_STA_FLG_MAX_AGG_SIZE_MSK); @@ -6939,8 +6935,6 @@ iwx_mld_add_sta_cmd(struct iwx_softc *sc int cmd_ver; size_t cmd_size; uint32_t aggsize, mpdu_dens; - const uint32_t max_aggsize = (IWX_STA_FLG_MAX_AGG_SIZE_4M >> - IWX_STA_FLG_MAX_AGG_SIZE_SHIFT); int err, changes; cmd_ver = iwx_lookup_cmd_ver(sc, IWX_MAC_CONF_GROUP, @@ -7032,8 +7026,6 @@ iwx_mld_add_sta_cmd(struct iwx_softc *sc aggsize = (in->in_ni.ni_ampdu_param & IEEE80211_AMPDU_PARAM_LE); } - if (aggsize > max_aggsize) - aggsize = max_aggsize; sta_cmd.tx_ampdu_spacing = htole32(mpdu_dens); sta_cmd.tx_ampdu_max_size = htole32(aggsize); -- wbr, Kirill