Skip to contentSkip to conversation

Fix ksize() breakage on older kernels

PATCH New Michael Buesch 1 participant 1 message Apr 25, 2009 802.11 (including cfg80211/NL80211)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix ksize() breakage on older kernels

The following patch should fix the ksize() compilation error for older kernels without exported ksize().

---

net/wireless/scan.c +6 -3
Index: compat-wireless-2009-04-20/net/wireless/scan.c
===================================================================
@@ -377,7 +377,11 @@
 			size_t used = dev->wiphy.bss_priv_size + sizeof(*res);
 			size_t ielen = res->pub.len_information_elements;
 
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,28)
+			if (0) {
+#else
 			if (ksize(found) >= used + ielen) {
+#endif
 				memcpy(found->pub.information_elements,
 				       res->pub.information_elements, ielen);
 				found->pub.len_information_elements = ielen;
@@ -385,9 +389,8 @@
 				u8 *ies = found->pub.information_elements;
 
 				if (found->ies_allocated) {
-					if (ksize(ies) < ielen)
-						ies = krealloc(ies, ielen,
-							       GFP_ATOMIC);
+					ies = krealloc(ies, ielen,
+						       GFP_ATOMIC);
 				} else
 					ies = kmalloc(ielen, GFP_ATOMIC);
 
Signature · 1 line
Greetings, Michael.