Skip to contentSkip to conversation

b43: N-PHY: handle allocation fail in samples generation

PATCH In review Rafał Miłecki 2 participants 5 messages Feb 4, 2010 – Feb 5, 2010 Networking drivers (wireless)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 b43: N-PHY: handle allocation fail in samples generation

---
 drivers/net/wireless/b43/phy_n.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
drivers/net/wireless/b43/phy_n.c +4 -0
index 074b34c..795bb1e 100644
@@ -1069,6 +1069,10 @@ static u16 b43_nphy_gen_load_samples(struct b43_wldev *dev, u32 freq, u16 max,
 	}
 
 	samples = kzalloc(len * sizeof(struct b43_c32), GFP_KERNEL);
+	if (!samples) {
+		b43err(dev->wl, "allocation for samples generation failed\n");
+		return 0;
+	}
 	rot = (((freq * 36) / bw) << 16) / 100;
 	angle = 0;
 
Signature · 1 line
1.6.4.2
#1 lore raw

2010/2/4 Rafał Miłecki <[email protected]>:

Quoted 10 lines

---
 drivers/net/wireless/b43/phy_n.c |    4 ++++

 1 files changed, 4 insertions(+), 0 deletions(-)
drivers/net/wireless/b43/phy_n.c +0 -0
index 074b34c..795bb1e 100644

drivers/net/wireless/b43/phy_n.c static u16 b43_nphy_gen_load_samples(struct b43_wldev *dev, u32 freq, u16 max, · line 1074

Quoted 6 lines
drivers/net/wireless/b43/phy_n.c +3 -0
@@ -1069,6 +1069,10 @@ static u16 b43_nphy_gen_load_samples(struct b43_wldev *dev, u32 freq, u16 max,
        }
 
        samples = kzalloc(len * sizeof(struct b43_c32), GFP_KERNEL);
+       if (!samples) {
+               b43err(dev->wl, "allocation for samples generation failed\n");
+               return 0;

return -ENOMEM;

Quoted 12 lines
drivers/net/wireless/b43/phy_n.c +1 -1
+       }
        rot = (((freq * 36) / bw) << 16) / 100;
        angle = 0;
 
--

1.6.4.2

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Signature · 1 line
Vista: [V]iruses, [I]ntruders, [S]pyware, [T]rojans and [A]dware. :-)
#2 lore raw

W dniu 5 lutego 2010 18:34 użytkownik Gábor Stefanik

Quoted 13 lines · <[email protected]> napisał:

2010/2/4 Rafał Miłecki <[email protected]>:

Quoted 12 lines

---
 drivers/net/wireless/b43/phy_n.c |    4 ++++

 1 files changed, 4 insertions(+), 0 deletions(-)
drivers/net/wireless/b43/phy_n.c +0 -0
index 074b34c..795bb1e 100644
@@ -1069,6 +1069,10 @@ static u16 b43_nphy_gen_load_samples(struct b43_wldev *dev, u32 freq, u16 max,
        }
 
Quoted 6 lines

drivers/net/wireless/b43/phy_n.c static u16 b43_nphy_gen_load_samples(struct b43_wldev *dev, u32 freq, u16 max, · line 1074

Quoted 4 lines
drivers/net/wireless/b43/phy_n.c +3 -0
        samples = kzalloc(len * sizeof(struct b43_c32), GFP_KERNEL);
+       if (!samples) {
+               b43err(dev->wl, "allocation for samples generation failed\n");
+               return 0;

return -ENOMEM;

Function was somehow designed to return unsigned only. Returning 0 means error (see place where we call b43_nphy_gen_load_samples, we check result for 0 there.

Is that OK then?

Quoted 18 lines
Quoted 7 lines
drivers/net/wireless/b43/phy_n.c +1 -1
+       }
        rot = (((freq * 36) / bw) << 16) / 100;
        angle = 0;
 
--

1.6.4.2

Quoted 5 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
Vista: [V]iruses, [I]ntruders, [S]pyware, [T]rojans and [A]dware. :-)

Signature · 1 line
Rafał
#3 lore raw

2010/2/5 Rafał Miłecki <[email protected]>:

Quoted 22 lines

W dniu 5 lutego 2010 18:34 użytkownik Gábor Stefanik

Quoted 13 lines · <[email protected]> napisał:

2010/2/4 Rafał Miłecki <[email protected]>:

Quoted 12 lines

---
 drivers/net/wireless/b43/phy_n.c |    4 ++++

 1 files changed, 4 insertions(+), 0 deletions(-)
drivers/net/wireless/b43/phy_n.c +0 -0
index 074b34c..795bb1e 100644
@@ -1069,6 +1069,10 @@ static u16 b43_nphy_gen_load_samples(struct b43_wldev *dev, u32 freq, u16 max,
        }
 
Quoted 6 lines

drivers/net/wireless/b43/phy_n.c static u16 b43_nphy_gen_load_samples(struct b43_wldev *dev, u32 freq, u16 max, · line 1074

Quoted 4 lines
drivers/net/wireless/b43/phy_n.c +3 -0
        samples = kzalloc(len * sizeof(struct b43_c32), GFP_KERNEL);
+       if (!samples) {
+               b43err(dev->wl, "allocation for samples generation failed\n");
+               return 0;

return -ENOMEM;

Quoted 5 lines

Function was somehow designed to return unsigned only. Returning 0 means error (see place where we call b43_nphy_gen_load_samples, we check result for 0 there.

Is that OK then?

In that case, OK - I thought this could be passed up to userspace handlers.

Quoted 25 lines
Quoted 16 lines
Quoted 8 lines
drivers/net/wireless/b43/phy_n.c +1 -1
+       }
        rot = (((freq * 36) / bw) << 16) / 100;
        angle = 0;
 
--

1.6.4.2

Quoted 5 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Quoted 3 lines

--
Vista: [V]iruses, [I]ntruders, [S]pyware, [T]rojans and [A]dware. :-)

--
Rafał

Signature · 1 line
Vista: [V]iruses, [I]ntruders, [S]pyware, [T]rojans and [A]dware. :-)
#4 lore raw

W dniu 5 lutego 2010 22:38 użytkownik Gábor Stefanik

Quoted 23 lines · <[email protected]> napisał:

2010/2/5 Rafał Miłecki <[email protected]>:

Quoted 22 lines

W dniu 5 lutego 2010 18:34 użytkownik Gábor Stefanik

Quoted 19 lines · <[email protected]> napisał:

2010/2/4 Rafał Miłecki <[email protected]>:

Quoted 10 lines

---
 drivers/net/wireless/b43/phy_n.c |    4 ++++

 1 files changed, 4 insertions(+), 0 deletions(-)
drivers/net/wireless/b43/phy_n.c +0 -0
index 074b34c..795bb1e 100644

drivers/net/wireless/b43/phy_n.c static u16 b43_nphy_gen_load_samples(struct b43_wldev *dev, u32 freq, u16 max, · line 1074

Quoted 6 lines
drivers/net/wireless/b43/phy_n.c +3 -0
@@ -1069,6 +1069,10 @@ static u16 b43_nphy_gen_load_samples(struct b43_wldev *dev, u32 freq, u16 max,
        }
 
        samples = kzalloc(len * sizeof(struct b43_c32), GFP_KERNEL);
+       if (!samples) {
+               b43err(dev->wl, "allocation for samples generation failed\n");
+               return 0;

return -ENOMEM;

Quoted 7 lines
Quoted 5 lines

Function was somehow designed to return unsigned only. Returning 0 means error (see place where we call b43_nphy_gen_load_samples, we check result for 0 there.

Is that OK then?

In that case, OK - I thought this could be passed up to userspace handlers.

Thanks for review :)

Signature · 1 line
Rafał