* [patch] wimax: wimax_msg_alloc() returns ERR_PTR not null
@ 2010-04-22 9:46 Dan Carpenter
2010-04-22 21:59 ` Inaky Perez-Gonzalez
0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2010-04-22 9:46 UTC (permalink / raw)
To: Inaky Perez-Gonzalez
Cc: linux-wimax, André Goddard Rosa, wimax, netdev,
kernel-janitors
wimax_msg_alloc() returns an ERR_PTR and not null. I changed it to test
for ERR_PTR instead of null. I also added a check in front of the
kfree() because kfree() can handle null but not ERR_PTR.
Signed-off-by: Dan Carpenter <error27@gmail.com>
diff --git a/drivers/net/wimax/i2400m/rx.c b/drivers/net/wimax/i2400m/rx.c
index fa2e11e..05e2247 100644
--- a/drivers/net/wimax/i2400m/rx.c
+++ b/drivers/net/wimax/i2400m/rx.c
@@ -300,17 +300,16 @@ void i2400m_rx_ctl_ack(struct i2400m *i2400m,
d_printf(1, dev, "Huh? waiter for command reply cancelled\n");
goto error_waiter_cancelled;
}
- if (ack_skb == NULL) {
+ if (IS_ERR(ack_skb))
dev_err(dev, "CMD/GET/SET ack: cannot allocate SKB\n");
- i2400m->ack_skb = ERR_PTR(-ENOMEM);
- } else
- i2400m->ack_skb = ack_skb;
+ i2400m->ack_skb = ack_skb;
spin_unlock_irqrestore(&i2400m->rx_lock, flags);
complete(&i2400m->msg_completion);
return;
error_waiter_cancelled:
- kfree_skb(ack_skb);
+ if (!IS_ERR(ack_skb))
+ kfree_skb(ack_skb);
error_no_waiter:
spin_unlock_irqrestore(&i2400m->rx_lock, flags);
return;
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [patch] wimax: wimax_msg_alloc() returns ERR_PTR not null
2010-04-22 9:46 [patch] wimax: wimax_msg_alloc() returns ERR_PTR not null Dan Carpenter
@ 2010-04-22 21:59 ` Inaky Perez-Gonzalez
2010-04-22 22:56 ` David Miller
0 siblings, 1 reply; 3+ messages in thread
From: Inaky Perez-Gonzalez @ 2010-04-22 21:59 UTC (permalink / raw)
To: Dan Carpenter
Cc: netdev, André Goddard Rosa, kernel-janitors, wimax,
linux-wimax
On Thu, 2010-04-22 at 11:46 +0200, Dan Carpenter wrote:
> wimax_msg_alloc() returns an ERR_PTR and not null. I changed it to test
> for ERR_PTR instead of null. I also added a check in front of the
> kfree() because kfree() can handle null but not ERR_PTR.
>
> Signed-off-by: Dan Carpenter <error27@gmail.com>
Good catch thank you!
Will merge ASAP in preparation for the next push
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch] wimax: wimax_msg_alloc() returns ERR_PTR not null
2010-04-22 21:59 ` Inaky Perez-Gonzalez
@ 2010-04-22 22:56 ` David Miller
0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2010-04-22 22:56 UTC (permalink / raw)
To: inaky; +Cc: error27, netdev, andre.goddard, kernel-janitors, wimax,
linux-wimax
From: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Date: Thu, 22 Apr 2010 14:59:56 -0700
> On Thu, 2010-04-22 at 11:46 +0200, Dan Carpenter wrote:
>> wimax_msg_alloc() returns an ERR_PTR and not null. I changed it to test
>> for ERR_PTR instead of null. I also added a check in front of the
>> kfree() because kfree() can handle null but not ERR_PTR.
>>
>> Signed-off-by: Dan Carpenter <error27@gmail.com>
>
> Good catch thank you!
>
> Will merge ASAP in preparation for the next push
There was another wimax fix from Dan, subject:
[patch] wimax: checking ERR_PTR vs null
make sure you integrate that one too.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-04-22 22:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-22 9:46 [patch] wimax: wimax_msg_alloc() returns ERR_PTR not null Dan Carpenter
2010-04-22 21:59 ` Inaky Perez-Gonzalez
2010-04-22 22:56 ` David Miller
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).