linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] staging: brcm80211: Fix memory leak after kmalloc failure
@ 2011-02-19 23:29 Stefan Weil
  2011-02-23 22:05 ` Greg KH
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Weil @ 2011-02-19 23:29 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Stefan Weil, Brett Rudley, Henry Ptasinski, linux-wireless, devel,
	linux-kernel

This error was spotted by cppcheck:

drivers/staging/brcm80211/phy/wlc_phy_lcn.c:4053: error: Memory leak: ptr

Cc: Brett Rudley <brudley@broadcom.com>
Cc: Henry Ptasinski <henryp@broadcom.com>
Cc: linux-wireless@vger.kernel.org
Cc: devel@driverdev.osuosl.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
---
 drivers/staging/brcm80211/phy/wlc_phy_lcn.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/staging/brcm80211/phy/wlc_phy_lcn.c b/drivers/staging/brcm80211/phy/wlc_phy_lcn.c
index 3ac2b49..9e2cb60 100644
--- a/drivers/staging/brcm80211/phy/wlc_phy_lcn.c
+++ b/drivers/staging/brcm80211/phy/wlc_phy_lcn.c
@@ -4050,6 +4050,7 @@ wlc_lcnphy_a1(phy_info_t *pi, int cal_type, int num_levels, int step_size_lg2)
 
 	phy_c32 = kmalloc(sizeof(u16) * 20, GFP_ATOMIC);
 	if (NULL == phy_c32) {
+		kfree(ptr);
 		return;
 	}
 	phy_c26 = read_phy_reg(pi, 0x6da);
-- 
1.7.2.3


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

* Re: [PATCH] staging: brcm80211: Fix memory leak after kmalloc failure
  2011-02-19 23:29 [PATCH] staging: brcm80211: Fix memory leak after kmalloc failure Stefan Weil
@ 2011-02-23 22:05 ` Greg KH
  2011-02-24 21:09   ` Stefan Weil
  0 siblings, 1 reply; 4+ messages in thread
From: Greg KH @ 2011-02-23 22:05 UTC (permalink / raw)
  To: Stefan Weil
  Cc: Greg Kroah-Hartman, Brett Rudley, Henry Ptasinski, linux-wireless,
	devel, linux-kernel

On Sun, Feb 20, 2011 at 12:29:11AM +0100, Stefan Weil wrote:
> This error was spotted by cppcheck:
> 
> drivers/staging/brcm80211/phy/wlc_phy_lcn.c:4053: error: Memory leak: ptr
> 
> Cc: Brett Rudley <brudley@broadcom.com>
> Cc: Henry Ptasinski <henryp@broadcom.com>
> Cc: linux-wireless@vger.kernel.org
> Cc: devel@driverdev.osuosl.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Stefan Weil <weil@mail.berlios.de>
> ---
>  drivers/staging/brcm80211/phy/wlc_phy_lcn.c |    1 +

What tree did you make this against?  This file isn't in the linux-next
tree anymore.

thanks,

greg k-h

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

* Re: [PATCH] staging: brcm80211: Fix memory leak after kmalloc failure
  2011-02-23 22:05 ` Greg KH
@ 2011-02-24 21:09   ` Stefan Weil
  2011-02-24 21:11     ` [PATCH v2] " Stefan Weil
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Weil @ 2011-02-24 21:09 UTC (permalink / raw)
  To: Greg KH
  Cc: Greg Kroah-Hartman, Brett Rudley, Henry Ptasinski, linux-wireless,
	devel, linux-kernel

Am 23.02.2011 23:05, schrieb Greg KH:
> On Sun, Feb 20, 2011 at 12:29:11AM +0100, Stefan Weil wrote:
>> This error was spotted by cppcheck:
>>
>> drivers/staging/brcm80211/phy/wlc_phy_lcn.c:4053: error: Memory leak: ptr
>>
>> Cc: Brett Rudley <brudley@broadcom.com>
>> Cc: Henry Ptasinski <henryp@broadcom.com>
>> Cc: linux-wireless@vger.kernel.org
>> Cc: devel@driverdev.osuosl.org
>> Cc: linux-kernel@vger.kernel.org
>> Signed-off-by: Stefan Weil <weil@mail.berlios.de>
>> ---
>> drivers/staging/brcm80211/phy/wlc_phy_lcn.c | 1 +
>
> What tree did you make this against? This file isn't in the linux-next
> tree anymore.
>
> thanks,
>
> greg k-h

The patch was based on 
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git.

In linux-next, the file was moved to a different directory:

from drivers/staging/brcm80211/phy/wlc_phy_lcn.c
to   drivers/staging/brcm80211/brcmsmac/phy/wlc_phy_lcn.c

It still needs the same fix. I'll send a new patch based on latest 
linux-next.

Regards
Stefan W.


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

* [PATCH v2] staging: brcm80211: Fix memory leak after kmalloc failure
  2011-02-24 21:09   ` Stefan Weil
@ 2011-02-24 21:11     ` Stefan Weil
  0 siblings, 0 replies; 4+ messages in thread
From: Stefan Weil @ 2011-02-24 21:11 UTC (permalink / raw)
  To: greg
  Cc: Stefan Weil, Brett Rudley, Henry Ptasinski, Greg Kroah-Hartman,
	linux-wireless, devel, linux-kernel

This error was spotted by cppcheck:

drivers/staging/brcm80211/phy/wlc_phy_lcn.c:4053: error: Memory leak: ptr

v2:
Rebased patch on linux-next (file was moved to a new directory).

Cc: Brett Rudley <brudley@broadcom.com>
Cc: Henry Ptasinski <henryp@broadcom.com>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Cc: linux-wireless@vger.kernel.org
Cc: devel@driverdev.osuosl.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
---
 .../staging/brcm80211/brcmsmac/phy/wlc_phy_lcn.c   |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmsmac/phy/wlc_phy_lcn.c b/drivers/staging/brcm80211/brcmsmac/phy/wlc_phy_lcn.c
index 3fbbbb4..f027d50 100644
--- a/drivers/staging/brcm80211/brcmsmac/phy/wlc_phy_lcn.c
+++ b/drivers/staging/brcm80211/brcmsmac/phy/wlc_phy_lcn.c
@@ -4051,6 +4051,7 @@ wlc_lcnphy_a1(phy_info_t *pi, int cal_type, int num_levels, int step_size_lg2)
 
 	phy_c32 = kmalloc(sizeof(u16) * 20, GFP_ATOMIC);
 	if (NULL == phy_c32) {
+		kfree(ptr);
 		return;
 	}
 	phy_c26 = read_phy_reg(pi, 0x6da);
-- 
1.7.2.3


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

end of thread, other threads:[~2011-02-24 21:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-19 23:29 [PATCH] staging: brcm80211: Fix memory leak after kmalloc failure Stefan Weil
2011-02-23 22:05 ` Greg KH
2011-02-24 21:09   ` Stefan Weil
2011-02-24 21:11     ` [PATCH v2] " Stefan Weil

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