Skip to content

Commit 9a95e70

Browse files
jmberg-intelgregkh
authored andcommitted
wifi: virt_wifi: don't use strlen() in const context
[ Upstream commit 6e909f4 ] Looks like not all compilers allow strlen(constant) as a constant, so don't do that. Instead, revert back to defining the length as the first submission had it. Fixes: b5d14b0 ("wifi: virt_wifi: avoid reporting connection success with wrong SSID") Reported-by: kernel test robot <[email protected]> Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/ Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/ Signed-off-by: Johannes Berg <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 477163b commit 9a95e70

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

drivers/net/wireless/virtual/virt_wifi.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ static struct ieee80211_supported_band band_5ghz = {
137137
static u8 fake_router_bssid[ETH_ALEN] __ro_after_init = {};
138138

139139
#define VIRT_WIFI_SSID "VirtWifi"
140+
#define VIRT_WIFI_SSID_LEN 8
140141

141142
static void virt_wifi_inform_bss(struct wiphy *wiphy)
142143
{
@@ -148,7 +149,7 @@ static void virt_wifi_inform_bss(struct wiphy *wiphy)
148149
u8 ssid[8];
149150
} __packed ssid = {
150151
.tag = WLAN_EID_SSID,
151-
.len = strlen(VIRT_WIFI_SSID),
152+
.len = VIRT_WIFI_SSID_LEN,
152153
.ssid = VIRT_WIFI_SSID,
153154
};
154155

@@ -262,7 +263,7 @@ static void virt_wifi_connect_complete(struct work_struct *work)
262263
container_of(work, struct virt_wifi_netdev_priv, connect.work);
263264
u8 *requested_bss = priv->connect_requested_bss;
264265
bool right_addr = ether_addr_equal(requested_bss, fake_router_bssid);
265-
bool right_ssid = priv->connect_requested_ssid_len == strlen(VIRT_WIFI_SSID) &&
266+
bool right_ssid = priv->connect_requested_ssid_len == VIRT_WIFI_SSID_LEN &&
266267
!memcmp(priv->connect_requested_ssid, VIRT_WIFI_SSID,
267268
priv->connect_requested_ssid_len);
268269
u16 status = WLAN_STATUS_SUCCESS;

0 commit comments

Comments
 (0)