1 ksize() was added as of 2.6.29, it gives you the actual
2 size of the allocated data. Since we have no support for
3 this we simply do not optimize for it and deal with
4 large alloocations for the IEs.
6 We technically could backport this as
8 define ksize(bleh) SOME_LARGE_NUMBER
10 but doing it this way emphasis careful review
13 --- a/net/wireless/scan.c
14 +++ b/net/wireless/scan.c
15 @@ -426,9 +426,14 @@ cfg80211_bss_update(struct cfg80211_regi
16 size_t used = dev->wiphy.bss_priv_size + sizeof(*res);
17 size_t ielen = res->pub.len_proberesp_ies;
19 +#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,28)
21 + used = 0; /* just to shut up the compiler */
23 if (found->pub.proberesp_ies &&
24 !found->proberesp_ies_allocated &&
25 ksize(found) >= used + ielen) {
27 memcpy(found->pub.proberesp_ies,
28 res->pub.proberesp_ies, ielen);
29 found->pub.len_proberesp_ies = ielen;
30 @@ -459,9 +464,14 @@ cfg80211_bss_update(struct cfg80211_regi
31 size_t used = dev->wiphy.bss_priv_size + sizeof(*res);
32 size_t ielen = res->pub.len_beacon_ies;
34 +#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,28)
36 + used = 0; /* just to shut up the compiler */
38 if (found->pub.beacon_ies &&
39 !found->beacon_ies_allocated &&
40 ksize(found) >= used + ielen) {
42 memcpy(found->pub.beacon_ies,
43 res->pub.beacon_ies, ielen);
44 found->pub.len_beacon_ies = ielen;