From 4a73c76f02d01ea47ea749d055c01d6f55bc36ac Mon Sep 17 00:00:00 2001 From: Larry Finger Date: Mon, 10 May 2021 10:25:47 -0500 Subject: [PATCH] rtl8188eu: fix some UBSAN and kmalloc warnings Signed-off-by: Larry Finger --- os_dep/ioctl_cfg80211.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/os_dep/ioctl_cfg80211.c b/os_dep/ioctl_cfg80211.c index 536f1f2..6ea8adf 100644 --- a/os_dep/ioctl_cfg80211.c +++ b/os_dep/ioctl_cfg80211.c @@ -412,7 +412,7 @@ struct cfg80211_bss *rtw_cfg80211_inform_bss(struct adapter *padapter, struct wl } else { notify_signal = 100*translate_percentage_to_dbm(pnetwork->network.PhyInfo.SignalStrength);/* dbm */ } - buf = kzalloc(MAX_BSSINFO_LEN, GFP_KERNEL); + buf = kzalloc(MAX_BSSINFO_LEN, GFP_ATOMIC); if (!buf) goto exit; pbuf = buf; @@ -4417,10 +4417,13 @@ static void cfg80211_rtw_mgmt_frame_register(struct wiphy *wiphy, { struct adapter *adapter = wiphy_to_adapter(wiphy); #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0)) - u16 frame_type = BIT(upd->global_stypes << 4); + u16 frame_type; bool reg = false; #endif - + if (upd->global_stypes < 11) + frame_type = (u16)BIT(upd->global_stypes << 4); + else + frame_type = 0; #ifdef CONFIG_DEBUG_CFG80211 DBG_88E(FUNC_ADPT_FMT" frame_type:%x, reg:%d\n", FUNC_ADPT_ARG(adapter), frame_type, reg);