* [PATCH] wireless: ipw2100: check result of kzalloc()
@ 2010-08-03 1:10 Christoph Fritz
2010-08-03 8:17 ` Dan Carpenter
0 siblings, 1 reply; 4+ messages in thread
From: Christoph Fritz @ 2010-08-03 1:10 UTC (permalink / raw)
To: John W. Linville
Cc: kernel-janitors, Zhu Yi, David S. Miller, Reinette Chatre,
linux-wireless
If kzalloc() fails return with -ENOMEM from ipw2100_net_init() which is
called by register_netdev.
Signed-off-by: Christoph Fritz <chf.fritz@googlemail.com>
---
drivers/net/wireless/ipw2x00/ipw2100.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/drivers/net/wireless/ipw2x00/ipw2100.c b/drivers/net/wireless/ipw2x00/ipw2100.c
index 0bd4dfa..908c176 100644
--- a/drivers/net/wireless/ipw2x00/ipw2100.c
+++ b/drivers/net/wireless/ipw2x00/ipw2100.c
@@ -1924,6 +1924,8 @@ static int ipw2100_net_init(struct net_device *dev)
bg_band->channels =
kzalloc(geo->bg_channels *
sizeof(struct ieee80211_channel), GFP_KERNEL);
+ if (!bg_band->channels)
+ return -ENOMEM;
/* translate geo->bg to bg_band.channels */
for (i = 0; i < geo->bg_channels; i++) {
bg_band->channels[i].band = IEEE80211_BAND_2GHZ;
--
1.7.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] wireless: ipw2100: check result of kzalloc()
2010-08-03 1:10 [PATCH] wireless: ipw2100: check result of kzalloc() Christoph Fritz
@ 2010-08-03 8:17 ` Dan Carpenter
2010-08-03 10:28 ` Christoph Fritz
0 siblings, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2010-08-03 8:17 UTC (permalink / raw)
To: Christoph Fritz
Cc: John W. Linville, kernel-janitors, Zhu Yi, David S. Miller,
Reinette Chatre, linux-wireless
On Tue, Aug 03, 2010 at 03:10:22AM +0200, Christoph Fritz wrote:
> If kzalloc() fails return with -ENOMEM from ipw2100_net_init() which is
> called by register_netdev.
>
> Signed-off-by: Christoph Fritz <chf.fritz@googlemail.com>
> ---
> drivers/net/wireless/ipw2x00/ipw2100.c | 2 ++
> 1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/net/wireless/ipw2x00/ipw2100.c b/drivers/net/wireless/ipw2x00/ipw2100.c
> index 0bd4dfa..908c176 100644
> --- a/drivers/net/wireless/ipw2x00/ipw2100.c
> +++ b/drivers/net/wireless/ipw2x00/ipw2100.c
> @@ -1924,6 +1924,8 @@ static int ipw2100_net_init(struct net_device *dev)
> bg_band->channels =
> kzalloc(geo->bg_channels *
> sizeof(struct ieee80211_channel), GFP_KERNEL);
> + if (!bg_band->channels)
There should be an "ipw2100_down(priv);" on the error path here.
> + return -ENOMEM;
> /* translate geo->bg to bg_band.channels */
regards,
dan carpenter
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] wireless: ipw2100: check result of kzalloc()
2010-08-03 8:17 ` Dan Carpenter
@ 2010-08-03 10:28 ` Christoph Fritz
2010-08-03 10:54 ` [PATCH v2] " Christoph Fritz
0 siblings, 1 reply; 4+ messages in thread
From: Christoph Fritz @ 2010-08-03 10:28 UTC (permalink / raw)
To: Dan Carpenter
Cc: John W. Linville, kernel-janitors, David S. Miller,
Reinette Chatre, linux-wireless
On Tue, 2010-08-03 at 10:17 +0200, Dan Carpenter wrote:
> On Tue, Aug 03, 2010 at 03:10:22AM +0200, Christoph Fritz wrote:
> > If kzalloc() fails return with -ENOMEM from ipw2100_net_init() which is
> > called by register_netdev.
> >
> > Signed-off-by: Christoph Fritz <chf.fritz@googlemail.com>
> > ---
> > drivers/net/wireless/ipw2x00/ipw2100.c | 2 ++
> > 1 files changed, 2 insertions(+), 0 deletions(-)
> >
> > diff --git a/drivers/net/wireless/ipw2x00/ipw2100.c b/drivers/net/wireless/ipw2x00/ipw2100.c
> > index 0bd4dfa..908c176 100644
> > --- a/drivers/net/wireless/ipw2x00/ipw2100.c
> > +++ b/drivers/net/wireless/ipw2x00/ipw2100.c
> > @@ -1924,6 +1924,8 @@ static int ipw2100_net_init(struct net_device *dev)
> > bg_band->channels =
> > kzalloc(geo->bg_channels *
> > sizeof(struct ieee80211_channel), GFP_KERNEL);
> > + if (!bg_band->channels)
>
> There should be an "ipw2100_down(priv);" on the error path here.
thanks for pointing this out, I'll add this.
>
> > + return -ENOMEM;
> > /* translate geo->bg to bg_band.channels */
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] wireless: ipw2100: check result of kzalloc()
2010-08-03 10:28 ` Christoph Fritz
@ 2010-08-03 10:54 ` Christoph Fritz
0 siblings, 0 replies; 4+ messages in thread
From: Christoph Fritz @ 2010-08-03 10:54 UTC (permalink / raw)
To: Dan Carpenter
Cc: John W. Linville, kernel-janitors, David S. Miller,
Reinette Chatre, linux-wireless
If kzalloc() fails return with -ENOMEM from ipw2100_net_init() which is
called by register_netdev.
CC: Dan Carpenter <error27@gmail.com>
Signed-off-by: Christoph Fritz <chf.fritz@googlemail.com>
---
drivers/net/wireless/ipw2x00/ipw2100.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/drivers/net/wireless/ipw2x00/ipw2100.c b/drivers/net/wireless/ipw2x00/ipw2100.c
index 0bd4dfa..cbec02a 100644
--- a/drivers/net/wireless/ipw2x00/ipw2100.c
+++ b/drivers/net/wireless/ipw2x00/ipw2100.c
@@ -1924,6 +1924,10 @@ static int ipw2100_net_init(struct net_device *dev)
bg_band->channels =
kzalloc(geo->bg_channels *
sizeof(struct ieee80211_channel), GFP_KERNEL);
+ if (!bg_band->channels) {
+ ipw2100_down(priv);
+ return -ENOMEM;
+ }
/* translate geo->bg to bg_band.channels */
for (i = 0; i < geo->bg_channels; i++) {
bg_band->channels[i].band = IEEE80211_BAND_2GHZ;
--
1.7.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-08-03 10:57 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-03 1:10 [PATCH] wireless: ipw2100: check result of kzalloc() Christoph Fritz
2010-08-03 8:17 ` Dan Carpenter
2010-08-03 10:28 ` Christoph Fritz
2010-08-03 10:54 ` [PATCH v2] " Christoph Fritz
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).