Skip to contentSkip to conversation

rt2x00: Invalid memory allocation check

PATCH In review Ivo van Doorn 1 participant 1 message Apr 27, 2006

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 8/32 rt2x00: Invalid memory allocation check

From: Ivo van Doorn <[email protected]>

Fix invalid check when allocating the memory for the rate structures. Instead of the channel pointer the rates pointer should be verified.

drivers/net/wireless/d80211/rt2x00/rt2400pci.c +1 -1
diff -uprN wireless-dev-rt2x00/drivers/net/wireless/d80211/rt2x00/rt2400pci.c wireless-dev-rt2x00-patch/drivers/net/wireless/d80211/rt2x00/rt2400pci.c
@@ -2036,7 +2036,7 @@ rt2400pci_init_hw(struct rt2x00_pci *rt2
 	hw->modes->num_rates = 4;
 	hw->modes->rates =
 		kzalloc(sizeof(struct ieee80211_rate) * 4, GFP_KERNEL);
-	if (!hw->modes->channels)
+	if (!hw->modes->rates)
 		goto exit_free_channels;
 
 	/*
drivers/net/wireless/d80211/rt2x00/rt2500pci.c +2 -2
diff -uprN wireless-dev-rt2x00/drivers/net/wireless/d80211/rt2x00/rt2500pci.c wireless-dev-rt2x00-patch/drivers/net/wireless/d80211/rt2x00/rt2500pci.c
@@ -2236,7 +2236,7 @@ rt2500pci_init_hw(struct rt2x00_pci *rt2
 		hw->modes->rates =
 			kzalloc((sizeof(struct ieee80211_rate) * 12),
 			GFP_KERNEL);
-		if (!hw->modes->channels)
+		if (!hw->modes->rates)
 			goto exit_free_channels;
 	} else {
 		hw->num_modes = 3;
@@ -2255,7 +2255,7 @@ rt2500pci_init_hw(struct rt2x00_pci *rt2
 		hw->modes->rates =
 			kzalloc((sizeof(struct ieee80211_rate) * 12),
 			GFP_KERNEL);
-		if (!hw->modes->channels)
+		if (!hw->modes->rates)
 			goto exit_free_channels;
 	}
 
drivers/net/wireless/d80211/rt2x00/rt2500usb.c +2 -2
diff -uprN wireless-dev-rt2x00/drivers/net/wireless/d80211/rt2x00/rt2500usb.c wireless-dev-rt2x00-patch/drivers/net/wireless/d80211/rt2x00/rt2500usb.c
@@ -1931,7 +1931,7 @@ rt2500usb_init_hw(struct rt2x00_usb *rt2
 		hw->modes->rates =
 			kzalloc((sizeof(struct ieee80211_rate) * 12),
 			GFP_KERNEL);
-		if (!hw->modes->channels)
+		if (!hw->modes->rates)
 			goto exit_free_channels;
 	} else {
 		hw->num_modes = 3;
@@ -1950,7 +1950,7 @@ rt2500usb_init_hw(struct rt2x00_usb *rt2
 		hw->modes->rates =
 			kzalloc((sizeof(struct ieee80211_rate) * 12),
 			GFP_KERNEL);
-		if (!hw->modes->channels)
+		if (!hw->modes->rates)
 			goto exit_free_channels;
 	}