wl1251: Add support for idle mode
[pandora-wifi.git] / patches / 02-ksize.patch
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.
5
6 We technically could backport this as
7
8 define ksize(bleh) SOME_LARGE_NUMBER
9
10 but doing it this way emphasis careful review
11 of the situation.
12
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;
18  
19 +#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,28)
20 +                       if (0) {
21 +                               used = 0; /* just to shut up the compiler */
22 +#else
23                         if (found->pub.proberesp_ies &&
24                             !found->proberesp_ies_allocated &&
25                             ksize(found) >= used + ielen) {
26 +#endif
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;
33  
34 +#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,28)
35 +                       if (0) {
36 +                               used = 0; /* just to shut up the compiler */
37 +#else
38                         if (found->pub.beacon_ies &&
39                             !found->beacon_ies_allocated &&
40                             ksize(found) >= used + ielen) {
41 +#endif
42                                 memcpy(found->pub.beacon_ies,
43                                        res->pub.beacon_ies, ielen);
44                                 found->pub.len_beacon_ies = ielen;