netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 8/32] rt2x00: Invalid memory allocation check
@ 2006-04-27 22:02 Ivo van Doorn
  0 siblings, 0 replies; only message in thread
From: Ivo van Doorn @ 2006-04-27 22:02 UTC (permalink / raw)
  To: netdev; +Cc: rt2x00-devel

[-- Attachment #1: Type: text/plain, Size: 2687 bytes --]

From: Ivo van Doorn <IvDoorn@gmail.com>

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

Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>

diff -uprN wireless-dev-rt2x00/drivers/net/wireless/d80211/rt2x00/rt2400pci.c wireless-dev-rt2x00-patch/drivers/net/wireless/d80211/rt2x00/rt2400pci.c
--- wireless-dev-rt2x00/drivers/net/wireless/d80211/rt2x00/rt2400pci.c	2006-04-27 21:40:43.000000000 +0200
+++ wireless-dev-rt2x00-patch/drivers/net/wireless/d80211/rt2x00/rt2400pci.c	2006-04-27 21:41:20.000000000 +0200
@@ -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;
 
 	/*
diff -uprN wireless-dev-rt2x00/drivers/net/wireless/d80211/rt2x00/rt2500pci.c wireless-dev-rt2x00-patch/drivers/net/wireless/d80211/rt2x00/rt2500pci.c
--- wireless-dev-rt2x00/drivers/net/wireless/d80211/rt2x00/rt2500pci.c	2006-04-27 21:40:43.000000000 +0200
+++ wireless-dev-rt2x00-patch/drivers/net/wireless/d80211/rt2x00/rt2500pci.c	2006-04-27 21:41:20.000000000 +0200
@@ -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;
 	}
 
diff -uprN wireless-dev-rt2x00/drivers/net/wireless/d80211/rt2x00/rt2500usb.c wireless-dev-rt2x00-patch/drivers/net/wireless/d80211/rt2x00/rt2500usb.c
--- wireless-dev-rt2x00/drivers/net/wireless/d80211/rt2x00/rt2500usb.c	2006-04-27 21:40:43.000000000 +0200
+++ wireless-dev-rt2x00-patch/drivers/net/wireless/d80211/rt2x00/rt2500usb.c	2006-04-27 21:41:20.000000000 +0200
@@ -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;
 	}
 

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-04-27 22:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-27 22:02 [PATCH 8/32] rt2x00: Invalid memory allocation check Ivo van Doorn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).