Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

staging: wlan-ng: cfg80211: Move large struct onto the heap

Fixes the following W=1 kernel build warning(s):

drivers/staging/wlan-ng/cfg80211.c: In function ‘prism2_scan’:
drivers/staging/wlan-ng/cfg80211.c:388:1: warning: the frame size of 1296 bytes is larger than 1024 bytes [-Wframe-larger-than=]

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Sumera Priyadarsini <sylphrenadin@gmail.com>
Cc: linux-staging@lists.linux.dev
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20210414181129.1628598-8-lee.jones@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Lee Jones and committed by
Greg Kroah-Hartman
ea82ff74 4a29a072

+17 -13
+17 -13
drivers/staging/wlan-ng/cfg80211.c
··· 276 276 struct prism2_wiphy_private *priv = wiphy_priv(wiphy); 277 277 struct wlandevice *wlandev; 278 278 struct p80211msg_dot11req_scan msg1; 279 - struct p80211msg_dot11req_scan_results msg2; 279 + struct p80211msg_dot11req_scan_results *msg2; 280 280 struct cfg80211_bss *bss; 281 281 struct cfg80211_scan_info info = {}; 282 282 ··· 300 300 netdev_err(dev, "Can't scan in AP mode\n"); 301 301 return -EOPNOTSUPP; 302 302 } 303 + 304 + msg2 = kzalloc(sizeof(*msg2), GFP_KERNEL); 305 + if (!msg2) 306 + return -ENOMEM; 303 307 304 308 priv->scan_request = request; 305 309 ··· 346 342 for (i = 0; i < numbss; i++) { 347 343 int freq; 348 344 349 - memset(&msg2, 0, sizeof(msg2)); 350 - msg2.msgcode = DIDMSG_DOT11REQ_SCAN_RESULTS; 351 - msg2.bssindex.data = i; 345 + msg2->msgcode = DIDMSG_DOT11REQ_SCAN_RESULTS; 346 + msg2->bssindex.data = i; 352 347 353 348 result = p80211req_dorequest(wlandev, (u8 *)&msg2); 354 349 if ((result != 0) || 355 - (msg2.resultcode.data != P80211ENUM_resultcode_success)) { 350 + (msg2->resultcode.data != P80211ENUM_resultcode_success)) { 356 351 break; 357 352 } 358 353 359 354 ie_buf[0] = WLAN_EID_SSID; 360 - ie_buf[1] = msg2.ssid.data.len; 355 + ie_buf[1] = msg2->ssid.data.len; 361 356 ie_len = ie_buf[1] + 2; 362 - memcpy(&ie_buf[2], &msg2.ssid.data.data, msg2.ssid.data.len); 363 - freq = ieee80211_channel_to_frequency(msg2.dschannel.data, 357 + memcpy(&ie_buf[2], &msg2->ssid.data.data, msg2->ssid.data.len); 358 + freq = ieee80211_channel_to_frequency(msg2->dschannel.data, 364 359 NL80211_BAND_2GHZ); 365 360 bss = cfg80211_inform_bss(wiphy, 366 361 ieee80211_get_channel(wiphy, freq), 367 362 CFG80211_BSS_FTYPE_UNKNOWN, 368 - (const u8 *)&msg2.bssid.data.data, 369 - msg2.timestamp.data, msg2.capinfo.data, 370 - msg2.beaconperiod.data, 363 + (const u8 *)&msg2->bssid.data.data, 364 + msg2->timestamp.data, msg2->capinfo.data, 365 + msg2->beaconperiod.data, 371 366 ie_buf, 372 367 ie_len, 373 - (msg2.signal.data - 65536) * 100, /* Conversion to signed type */ 368 + (msg2->signal.data - 65536) * 100, /* Conversion to signed type */ 374 369 GFP_KERNEL); 375 370 376 371 if (!bss) { ··· 381 378 } 382 379 383 380 if (result) 384 - err = prism2_result2err(msg2.resultcode.data); 381 + err = prism2_result2err(msg2->resultcode.data); 385 382 386 383 exit: 387 384 info.aborted = !!(err); 388 385 cfg80211_scan_done(request, &info); 389 386 priv->scan_request = NULL; 387 + kfree(msg2); 390 388 return err; 391 389 } 392 390