Revert "wifi: cfg80211: fix UBSAN noise in cfg80211_wext_siwscan()"

This reverts commit 26dc7df8fb.
This commit is contained in:
Ksawlii 2024-11-24 00:23:30 +01:00
parent 13ab2b7319
commit 8b8bebf286

View file

@ -2802,8 +2802,8 @@ int cfg80211_wext_siwscan(struct net_device *dev,
n_channels = ieee80211_get_num_supported_channels(wiphy);
}
creq = kzalloc(struct_size(creq, channels, n_channels) +
sizeof(struct cfg80211_ssid),
creq = kzalloc(sizeof(*creq) + sizeof(struct cfg80211_ssid) +
n_channels * sizeof(void *),
GFP_ATOMIC);
if (!creq) {
err = -ENOMEM;
@ -2813,7 +2813,7 @@ int cfg80211_wext_siwscan(struct net_device *dev,
creq->wiphy = wiphy;
creq->wdev = dev->ieee80211_ptr;
/* SSIDs come after channels */
creq->ssids = (void *)creq + struct_size(creq, channels, n_channels);
creq->ssids = (void *)&creq->channels[n_channels];
creq->n_channels = n_channels;
creq->n_ssids = 1;
creq->scan_start = jiffies;