linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] brcmfmac: check return from kzalloc in brcmf_fweh_process_event
@ 2012-11-19 15:53 John W. Linville
  2012-11-19 17:39 ` Arend van Spriel
  0 siblings, 1 reply; 4+ messages in thread
From: John W. Linville @ 2012-11-19 15:53 UTC (permalink / raw)
  To: linux-wireless
  Cc: Fengguang Wu, Arend van Spriel, Franky Lin, John W. Linville

From: "John W. Linville" <linville@tuxdriver.com>

Signed-off-by: John W. Linville <linville@tuxdriver.com>
Reported-by: Fengguang Wu <fengguang.wu@intel.com>
---
 drivers/net/wireless/brcm80211/brcmfmac/fweh.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
index 1e4188c..fa8fc44 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
@@ -494,6 +494,9 @@ void brcmf_fweh_process_event(struct brcmf_pub *drvr,
 		alloc_flag = GFP_ATOMIC;
 
 	event = kzalloc(sizeof(*event) + datalen, alloc_flag);
+	if (!event)
+		return;
+
 	event->code = code;
 	event->ifidx = *ifidx;
 
-- 
1.7.11.7


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

* Re: [PATCH] brcmfmac: check return from kzalloc in brcmf_fweh_process_event
  2012-11-19 15:53 [PATCH] brcmfmac: check return from kzalloc in brcmf_fweh_process_event John W. Linville
@ 2012-11-19 17:39 ` Arend van Spriel
  2012-11-20  7:57   ` Kalle Valo
  0 siblings, 1 reply; 4+ messages in thread
From: Arend van Spriel @ 2012-11-19 17:39 UTC (permalink / raw)
  To: John W. Linville; +Cc: linux-wireless, Fengguang Wu, Franky Lin

On 11/19/2012 04:53 PM, John W. Linville wrote:
> From: "John W. Linville" <linville@tuxdriver.com>
>
> Signed-off-by: John W. Linville <linville@tuxdriver.com>
> Reported-by: Fengguang Wu <fengguang.wu@intel.com>
> ---
>   drivers/net/wireless/brcm80211/brcmfmac/fweh.c | 3 +++
>   1 file changed, 3 insertions(+)
>
> diff --git a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
> index 1e4188c..fa8fc44 100644
> --- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
> +++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
> @@ -494,6 +494,9 @@ void brcmf_fweh_process_event(struct brcmf_pub *drvr,
>   		alloc_flag = GFP_ATOMIC;
>
>   	event = kzalloc(sizeof(*event) + datalen, alloc_flag);
> +	if (!event)

My fix included a debug statement about the discarded event from firmware.

> +		return;
> +
>   	event->code = code;
>   	event->ifidx = *ifidx;
>
>

I will deal with the merge so:

Acked-by: Arend van Spriel <arend@broadcom.com>

Gr. AvS


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

* Re: [PATCH] brcmfmac: check return from kzalloc in brcmf_fweh_process_event
  2012-11-19 17:39 ` Arend van Spriel
@ 2012-11-20  7:57   ` Kalle Valo
  2012-11-20 19:51     ` Arend van Spriel
  0 siblings, 1 reply; 4+ messages in thread
From: Kalle Valo @ 2012-11-20  7:57 UTC (permalink / raw)
  To: Arend van Spriel
  Cc: John W. Linville, linux-wireless, Fengguang Wu, Franky Lin

"Arend van Spriel" <arend@broadcom.com> writes:

> On 11/19/2012 04:53 PM, John W. Linville wrote:
>> From: "John W. Linville" <linville@tuxdriver.com>
>>
>> Signed-off-by: John W. Linville <linville@tuxdriver.com>
>> Reported-by: Fengguang Wu <fengguang.wu@intel.com>

[...]

>>   	event = kzalloc(sizeof(*event) + datalen, alloc_flag);
>> +	if (!event)
>
> My fix included a debug statement about the discarded event from firmware.

Someone once suggested that memory allocation errors should not be
printed by the drivers as the memory subsystem does that anyway. No idea
if that's a good advice or not, but I try to follow it.

-- 
Kalle Valo

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

* Re: [PATCH] brcmfmac: check return from kzalloc in brcmf_fweh_process_event
  2012-11-20  7:57   ` Kalle Valo
@ 2012-11-20 19:51     ` Arend van Spriel
  0 siblings, 0 replies; 4+ messages in thread
From: Arend van Spriel @ 2012-11-20 19:51 UTC (permalink / raw)
  To: Kalle Valo; +Cc: John W. Linville, linux-wireless, Fengguang Wu, Franky Lin

On 11/20/2012 08:57 AM, Kalle Valo wrote:
> "Arend van Spriel" <arend@broadcom.com> writes:
>
>> On 11/19/2012 04:53 PM, John W. Linville wrote:
>>> From: "John W. Linville" <linville@tuxdriver.com>
>>>
>>> Signed-off-by: John W. Linville <linville@tuxdriver.com>
>>> Reported-by: Fengguang Wu <fengguang.wu@intel.com>
>
> [...]
>
>>>    	event = kzalloc(sizeof(*event) + datalen, alloc_flag);
>>> +	if (!event)
>>
>> My fix included a debug statement about the discarded event from firmware.
>
> Someone once suggested that memory allocation errors should not be
> printed by the drivers as the memory subsystem does that anyway. No idea
> if that's a good advice or not, but I try to follow it.
>

Hi Kalle,

In general, I follow the same suggestion. However, in this particular 
code path we are handling an event message from the device, which is 
being discarded due to the allocation failure. That could be derived 
from the trace that kzalloc spews, but I preferred to have it explicitly 
stated in the logs.

Gr. AvS


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

end of thread, other threads:[~2012-11-20 19:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-19 15:53 [PATCH] brcmfmac: check return from kzalloc in brcmf_fweh_process_event John W. Linville
2012-11-19 17:39 ` Arend van Spriel
2012-11-20  7:57   ` Kalle Valo
2012-11-20 19:51     ` Arend van Spriel

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).