public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ipw2200: Missing kmalloc check
@ 2005-09-05  2:14 Panagiotis Issaris
  2005-09-05 11:53 ` Jiri Slaby
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Panagiotis Issaris @ 2005-09-05  2:14 UTC (permalink / raw)
  To: ipw2100-admin; +Cc: linux-kernel


The ipw2200 driver code in current GIT contains a kmalloc() followed by
a memset() without handling a possible memory allocation failure.

Signed-off-by: Panagiotis Issaris <panagiotis.issaris@gmail.com>
---

 drivers/net/wireless/ipw2200.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

8e288419b49346fee512739acac446c951727d04
diff --git a/drivers/net/wireless/ipw2200.c
b/drivers/net/wireless/ipw2200.c
--- a/drivers/net/wireless/ipw2200.c
+++ b/drivers/net/wireless/ipw2200.c
@@ -3976,6 +3976,10 @@ static struct ipw_rx_queue *ipw_rx_queue
 	int i;
 
 	rxq = (struct ipw_rx_queue *)kmalloc(sizeof(*rxq), GFP_KERNEL);
+	if (unlikely(!rxq)) {
+		IPW_ERROR("memory allocation failed\n");
+		return NULL;
+	}
 	memset(rxq, 0, sizeof(*rxq));
 	spin_lock_init(&rxq->lock);
 	INIT_LIST_HEAD(&rxq->rx_free);



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] ipw2200: Missing kmalloc check
  2005-09-05  2:14 [PATCH] ipw2200: Missing kmalloc check Panagiotis Issaris
@ 2005-09-05 11:53 ` Jiri Slaby
  2005-09-05 14:26   ` Takis
  2005-10-28 20:57 ` Jeff Garzik
  2005-11-07 18:32 ` Rolf Eike Beer
  2 siblings, 1 reply; 6+ messages in thread
From: Jiri Slaby @ 2005-09-05 11:53 UTC (permalink / raw)
  To: Panagiotis Issaris; +Cc: ipw2100-admin, linux-kernel

Panagiotis Issaris napsal(a):

>The ipw2200 driver code in current GIT contains a kmalloc() followed by
>a memset() without handling a possible memory allocation failure.
>
>Signed-off-by: Panagiotis Issaris <panagiotis.issaris@gmail.com>
>---
>
> drivers/net/wireless/ipw2200.c |    4 ++++
> 1 files changed, 4 insertions(+), 0 deletions(-)
>
>8e288419b49346fee512739acac446c951727d04
>diff --git a/drivers/net/wireless/ipw2200.c
>b/drivers/net/wireless/ipw2200.c
>--- a/drivers/net/wireless/ipw2200.c
>+++ b/drivers/net/wireless/ipw2200.c
>@@ -3976,6 +3976,10 @@ static struct ipw_rx_queue *ipw_rx_queue
> 	int i;
> 
> 	rxq = (struct ipw_rx_queue *)kmalloc(sizeof(*rxq), GFP_KERNEL);
>+	if (unlikely(!rxq)) {
>+		IPW_ERROR("memory allocation failed\n");
>+		return NULL;
>+	}
> 	memset(rxq, 0, sizeof(*rxq));
>  
>
and use kzalloc instead of kmalloc and memset 0?

> 	spin_lock_init(&rxq->lock);
> 	INIT_LIST_HEAD(&rxq->rx_free);
>  
>
-- 
Jiri Slaby         www.fi.muni.cz/~xslaby
~\-/~      jirislaby@gmail.com      ~\-/~
241B347EC88228DE51EE A49C4A73A25004CB2A10


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] ipw2200: Missing kmalloc check
  2005-09-05 11:53 ` Jiri Slaby
@ 2005-09-05 14:26   ` Takis
  0 siblings, 0 replies; 6+ messages in thread
From: Takis @ 2005-09-05 14:26 UTC (permalink / raw)
  To: Jiri Slaby; +Cc: ipw2100-admin, linux-kernel

On 9/5/05, Jiri Slaby <jirislaby@gmail.com> wrote:
> >       rxq = (struct ipw_rx_queue *)kmalloc(sizeof(*rxq), GFP_KERNEL);
> >+      if (unlikely(!rxq)) {
> >+              IPW_ERROR("memory allocation failed\n");
> >+              return NULL;
> >+      }
> >       memset(rxq, 0, sizeof(*rxq));
> >
> >
> and use kzalloc instead of kmalloc and memset 0?

Yes, but Morton's tree hasn't got the ipw2200 yet, while Linus'
Linux-tree hasn't pulled in the patches containing kzalloc. I'll send
a new patch as soon as the kzalloc patch get in Linus' tree or ipw in
Marton's.

With friendly regards,
Takis

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] ipw2200: Missing kmalloc check
  2005-09-05  2:14 [PATCH] ipw2200: Missing kmalloc check Panagiotis Issaris
  2005-09-05 11:53 ` Jiri Slaby
@ 2005-10-28 20:57 ` Jeff Garzik
  2005-11-07 18:32 ` Rolf Eike Beer
  2 siblings, 0 replies; 6+ messages in thread
From: Jeff Garzik @ 2005-10-28 20:57 UTC (permalink / raw)
  To: Panagiotis Issaris; +Cc: ipw2100-admin, linux-kernel

applied


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] ipw2200: Missing kmalloc check
  2005-09-05  2:14 [PATCH] ipw2200: Missing kmalloc check Panagiotis Issaris
  2005-09-05 11:53 ` Jiri Slaby
  2005-10-28 20:57 ` Jeff Garzik
@ 2005-11-07 18:32 ` Rolf Eike Beer
  2005-11-07 20:35   ` Takis
  2 siblings, 1 reply; 6+ messages in thread
From: Rolf Eike Beer @ 2005-11-07 18:32 UTC (permalink / raw)
  To: Panagiotis Issaris; +Cc: ipw2100-admin, linux-kernel

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

Panagiotis Issaris wrote:
>The ipw2200 driver code in current GIT contains a kmalloc() followed by
>a memset() without handling a possible memory allocation failure.
>
>Signed-off-by: Panagiotis Issaris <panagiotis.issaris@gmail.com>
>---
>
> drivers/net/wireless/ipw2200.c |    4 ++++
> 1 files changed, 4 insertions(+), 0 deletions(-)
>
>8e288419b49346fee512739acac446c951727d04
>diff --git a/drivers/net/wireless/ipw2200.c
>b/drivers/net/wireless/ipw2200.c
>--- a/drivers/net/wireless/ipw2200.c
>+++ b/drivers/net/wireless/ipw2200.c
>@@ -3976,6 +3976,10 @@ static struct ipw_rx_queue *ipw_rx_queue
> 	int i;
>
> 	rxq = (struct ipw_rx_queue *)kmalloc(sizeof(*rxq), GFP_KERNEL);
>+	if (unlikely(!rxq)) {
>+		IPW_ERROR("memory allocation failed\n");
>+		return NULL;
>+	}
> 	memset(rxq, 0, sizeof(*rxq));

Please remove the cast and use kzalloc() instead of kmalloc() and 
memset(,0,).

Eike

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] ipw2200: Missing kmalloc check
  2005-11-07 18:32 ` Rolf Eike Beer
@ 2005-11-07 20:35   ` Takis
  0 siblings, 0 replies; 6+ messages in thread
From: Takis @ 2005-11-07 20:35 UTC (permalink / raw)
  To: Rolf Eike Beer; +Cc: ipw2100-admin, linux-kernel

- Use kzalloc for IPW2200
- Fix config dependency for IPW2200

Signed-off-by: Panagiotis Issaris <takis@issaris.org>

---

 drivers/net/wireless/Kconfig   |    2 +-
 drivers/net/wireless/ipw2200.c |    3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)

applies-to: b3efbcb770e1202b65aee2fe70ea5a407a60e6a5
7e0cb9f1c4a239d06a0013997fc987c77fa46516
diff --git a/drivers/net/wireless/Kconfig b/drivers/net/wireless/Kconfig
index 7187958..3cf1ae2 100644
--- a/drivers/net/wireless/Kconfig
+++ b/drivers/net/wireless/Kconfig
@@ -192,7 +192,7 @@ config IPW_DEBUG

 config IPW2200
        tristate "Intel PRO/Wireless 2200BG and 2915ABG Network Connection"
-       depends on IEEE80211 && PCI
+       depends on NET_RADIO && IEEE80211 && PCI
        select FW_LOADER
        ---help---
           A driver for the Intel PRO/Wireless 2200BG and 2915ABG Network
diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c
index 3db0c32..6da11b5 100644
--- a/drivers/net/wireless/ipw2200.c
+++ b/drivers/net/wireless/ipw2200.c
@@ -4029,12 +4029,11 @@ static struct ipw_rx_queue *ipw_rx_queue
        struct ipw_rx_queue *rxq;
        int i;

-       rxq = (struct ipw_rx_queue *)kmalloc(sizeof(*rxq), GFP_KERNEL);
+       rxq = kzalloc(sizeof(*rxq), GFP_KERNEL);
        if (unlikely(!rxq)) {
                IPW_ERROR("memory allocation failed\n");
                return NULL;
        }
-       memset(rxq, 0, sizeof(*rxq));
        spin_lock_init(&rxq->lock);
        INIT_LIST_HEAD(&rxq->rx_free);
        INIT_LIST_HEAD(&rxq->rx_used);
---
0.99.9.GIT

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2005-11-07 20:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-05  2:14 [PATCH] ipw2200: Missing kmalloc check Panagiotis Issaris
2005-09-05 11:53 ` Jiri Slaby
2005-09-05 14:26   ` Takis
2005-10-28 20:57 ` Jeff Garzik
2005-11-07 18:32 ` Rolf Eike Beer
2005-11-07 20:35   ` Takis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox