Skip to content

Commit

Permalink
Fix compilation with GCC 12
Browse files Browse the repository at this point in the history
GCC 12 improved its detection of tautological address conditions.
Subsequently several of those were found in the source code.

This merge attempts to fix some of these conditions. While the author is
not totally sure that the fixes are correct, a version with these fixes
is used for several weeks now without any issues.

Unfortunately, not for all reported occasions a fix was found.
Therefore, address warnings and errors are suppressed in the Makefile
too.
  • Loading branch information
MaxG87 committed Oct 4, 2022
2 parents 01a4454 + e61bba5 commit 2b4f8e9
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ EXTRA_CFLAGS += -Wno-unused-function
EXTRA_CFLAGS += -Wno-unused-parameter
EXTRA_CFLAGS += -Wno-unused-variable
EXTRA_CFLAGS += -Wno-array-bounds
EXTRA_CFLAGS += -Wno-address

GCC_VER_49 := $(shell echo `$(CC) -dumpversion | cut -f1-2 -d.` \>= 4.9 | bc )
ifeq ($(GCC_VER_49),1)
Expand Down Expand Up @@ -2457,4 +2458,3 @@ clean:
rm -fr *.mod.c *.mod *.o .*.cmd *.ko *~
rm -fr .tmp_versions *.ur-safe
endif

6 changes: 3 additions & 3 deletions core/rtw_ap.c
Original file line number Diff line number Diff line change
Expand Up @@ -4400,7 +4400,7 @@ static u8 rtw_ap_update_chbw_by_ifbmp(struct dvobj_priv *dvobj, u8 ifbmp
int i;

for (i = 0; i < dvobj->iface_nums; i++) {
if (!(ifbmp & BIT(i)) || !dvobj->padapters)
if (!(ifbmp & BIT(i)) || !dvobj->padapters[i])
continue;

iface = dvobj->padapters[i];
Expand All @@ -4420,7 +4420,7 @@ static u8 rtw_ap_update_chbw_by_ifbmp(struct dvobj_priv *dvobj, u8 ifbmp
}

for (i = 0; i < dvobj->iface_nums; i++) {
if (!(ifbmp & BIT(i)) || !dvobj->padapters)
if (!(ifbmp & BIT(i)) || !dvobj->padapters[i])
continue;

iface = dvobj->padapters[i];
Expand Down Expand Up @@ -4591,7 +4591,7 @@ u8 rtw_ap_chbw_decision(_adapter *adapter, u8 ifbmp, u8 excl_ifbmp

#ifdef CONFIG_RTW_MESH
for (i = 0; i < dvobj->iface_nums; i++)
if ((ifbmp & BIT(i)) && dvobj->padapters)
if ((ifbmp & BIT(i)) && dvobj->padapters[i])
if (!MLME_IS_MESH(dvobj->padapters[i]))
break;
ifbmp_all_mesh = i >= dvobj->iface_nums ? 1 : 0;
Expand Down
3 changes: 1 addition & 2 deletions core/rtw_mlme_ext.c
Original file line number Diff line number Diff line change
Expand Up @@ -8995,7 +8995,7 @@ static u32 rtw_append_assoc_req_owe_ie(_adapter *adapter, u8 *pbuf)
if (sec == NULL)
goto exit;

if (sec->owe_ie && sec->owe_ie_len > 0) {
if (sec->owe_ie_len > 0) {
len = sec->owe_ie_len;
_rtw_memcpy(pbuf, sec->owe_ie, len);
}
Expand Down Expand Up @@ -16655,4 +16655,3 @@ int rtw_sae_preprocess(_adapter *adapter, const u8 *buf, u32 len, u8 tx)
return _SUCCESS;
#endif /* CONFIG_IOCTL_CFG80211 */
}

15 changes: 7 additions & 8 deletions core/rtw_sta_mgt.c
Original file line number Diff line number Diff line change
Expand Up @@ -380,13 +380,13 @@ static void _rtw_free_sta_recv_priv_lock(struct sta_recv_priv *psta_recvpriv)
void rtw_mfree_stainfo(struct sta_info *psta);
void rtw_mfree_stainfo(struct sta_info *psta)
{

if (&psta->lock != NULL)
_rtw_spinlock_free(&psta->lock);

_rtw_free_sta_xmit_priv_lock(&psta->sta_xmitpriv);
_rtw_free_sta_recv_priv_lock(&psta->sta_recvpriv);

// Here used to be some calls to helper functions that would call
// _rtw_spinlock_free several times. However, _rtw_spinlock_free does not
// do anything on Linux. Since this project is concerned only with Linux,
// it is safe to remove the calls entirely.
// This function is kept. Removing it would force us to remove it in the
// callers, which has the danger of becoming incompatible with possible
// future patches.
}


Expand Down Expand Up @@ -1342,4 +1342,3 @@ void dump_pre_link_sta_ctl(void *sel, struct sta_priv *stapriv)
}
}
#endif /* CONFIG_RTW_PRE_LINK_STA */

0 comments on commit 2b4f8e9

Please sign in to comment.