* [PATCH 4/4] drivers/net/wireless/mwifiex/scan.c: test the just-initialized value
@ 2011-08-22 14:00 ` Julia Lawall
0 siblings, 0 replies; 26+ messages in thread
From: Julia Lawall @ 2011-08-22 14:00 UTC (permalink / raw)
To: Bing Zhao
Cc: kernel-janitors, John W. Linville, linux-wireless, netdev, linux-kernel
From: Julia Lawall <julia@diku.dk>
Test the just-initialized value rather than some other one.
The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@r@
identifier x,y,f!={PTR_ERR,ERR_PTR,ERR_CAST};
statement S;
@@
x = f(...);
(
if (\(x == NULL\|IS_ERR(x)\)) S
|
*if (\(y == NULL\|IS_ERR(y)\))
{ ... when != x
return ...; }
)
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
---
drivers/net/wireless/mwifiex/scan.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/wireless/mwifiex/scan.c b/drivers/net/wireless/mwifiex/scan.c
index b28241c..d3111c9 100644
--- a/drivers/net/wireless/mwifiex/scan.c
+++ b/drivers/net/wireless/mwifiex/scan.c
@@ -1480,7 +1480,7 @@ mwifiex_update_curr_bss_params(struct mwifiex_private *priv,
return -ENOMEM;
}
beacon_ie = kzalloc(ie_len, GFP_KERNEL);
- if (!bss_desc) {
+ if (!beacon_ie) {
dev_err(priv->adapter->dev, " failed to alloc bss_desc\n");
return -ENOMEM;
}
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH 4/4] drivers/net/wireless/mwifiex/scan.c: test the just-initialized value
@ 2011-08-22 14:00 ` Julia Lawall
0 siblings, 0 replies; 26+ messages in thread
From: Julia Lawall @ 2011-08-22 14:00 UTC (permalink / raw)
To: Bing Zhao
Cc: kernel-janitors-u79uwXL29TY76Z2rM5mHXA, John W. Linville,
linux-wireless-u79uwXL29TY76Z2rM5mHXA,
netdev-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
From: Julia Lawall <julia-dAYI7NvHqcQ@public.gmane.org>
Test the just-initialized value rather than some other one.
The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@r@
identifier x,y,f!={PTR_ERR,ERR_PTR,ERR_CAST};
statement S;
@@
x = f(...);
(
if (\(x == NULL\|IS_ERR(x)\)) S
|
*if (\(y == NULL\|IS_ERR(y)\))
{ ... when != x
return ...; }
)
// </smpl>
Signed-off-by: Julia Lawall <julia-dAYI7NvHqcQ@public.gmane.org>
---
drivers/net/wireless/mwifiex/scan.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/wireless/mwifiex/scan.c b/drivers/net/wireless/mwifiex/scan.c
index b28241c..d3111c9 100644
--- a/drivers/net/wireless/mwifiex/scan.c
+++ b/drivers/net/wireless/mwifiex/scan.c
@@ -1480,7 +1480,7 @@ mwifiex_update_curr_bss_params(struct mwifiex_private *priv,
return -ENOMEM;
}
beacon_ie = kzalloc(ie_len, GFP_KERNEL);
- if (!bss_desc) {
+ if (!beacon_ie) {
dev_err(priv->adapter->dev, " failed to alloc bss_desc\n");
return -ENOMEM;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH 4/4] drivers/net/wireless/mwifiex/scan.c: test the just-initialized value
@ 2011-08-22 14:00 ` Julia Lawall
0 siblings, 0 replies; 26+ messages in thread
From: Julia Lawall @ 2011-08-22 14:00 UTC (permalink / raw)
To: Bing Zhao
Cc: kernel-janitors, John W. Linville, linux-wireless, netdev, linux-kernel
From: Julia Lawall <julia@diku.dk>
Test the just-initialized value rather than some other one.
The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@r@
identifier x,y,f!={PTR_ERR,ERR_PTR,ERR_CAST};
statement S;
@@
x = f(...);
(
if (\(x = NULL\|IS_ERR(x)\)) S
|
*if (\(y = NULL\|IS_ERR(y)\))
{ ... when != x
return ...; }
)
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
---
drivers/net/wireless/mwifiex/scan.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/wireless/mwifiex/scan.c b/drivers/net/wireless/mwifiex/scan.c
index b28241c..d3111c9 100644
--- a/drivers/net/wireless/mwifiex/scan.c
+++ b/drivers/net/wireless/mwifiex/scan.c
@@ -1480,7 +1480,7 @@ mwifiex_update_curr_bss_params(struct mwifiex_private *priv,
return -ENOMEM;
}
beacon_ie = kzalloc(ie_len, GFP_KERNEL);
- if (!bss_desc) {
+ if (!beacon_ie) {
dev_err(priv->adapter->dev, " failed to alloc bss_desc\n");
return -ENOMEM;
}
^ permalink raw reply related [flat|nested] 26+ messages in thread
* Re: [PATCH 4/4] drivers/net/wireless/mwifiex/scan.c: test the just-initialized value
2011-08-22 14:00 ` Julia Lawall
@ 2011-08-22 14:11 ` Pierre Louis Aublin
-1 siblings, 0 replies; 26+ messages in thread
From: Pierre Louis Aublin @ 2011-08-22 14:11 UTC (permalink / raw)
To: Julia Lawall
Cc: Bing Zhao, kernel-janitors, John W. Linville, linux-wireless,
netdev, linux-kernel
Hello all
On 08/22/2011 04:00 PM, Julia Lawall wrote:
> - if (!bss_desc) {
> + if (!beacon_ie) {
> dev_err(priv->adapter->dev, " failed to alloc bss_desc\n");
Shouldn't we also modify the error message, from "failed to alloc
bss_desc" to "failed to alloc beacon_ie" ?
Sincerely
Pierre Louis Aublin
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH 4/4] drivers/net/wireless/mwifiex/scan.c: test the just-initialized
@ 2011-08-22 14:11 ` Pierre Louis Aublin
0 siblings, 0 replies; 26+ messages in thread
From: Pierre Louis Aublin @ 2011-08-22 14:11 UTC (permalink / raw)
To: Julia Lawall
Cc: Bing Zhao, kernel-janitors, John W. Linville, linux-wireless,
netdev, linux-kernel
Hello all
On 08/22/2011 04:00 PM, Julia Lawall wrote:
> - if (!bss_desc) {
> + if (!beacon_ie) {
> dev_err(priv->adapter->dev, " failed to alloc bss_desc\n");
Shouldn't we also modify the error message, from "failed to alloc
bss_desc" to "failed to alloc beacon_ie" ?
Sincerely
Pierre Louis Aublin
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH 4/4] drivers/net/wireless/mwifiex/scan.c: test the just-initialized value
2011-08-22 14:11 ` [PATCH 4/4] drivers/net/wireless/mwifiex/scan.c: test the just-initialized Pierre Louis Aublin
@ 2011-08-22 14:12 ` Julia Lawall
-1 siblings, 0 replies; 26+ messages in thread
From: Julia Lawall @ 2011-08-22 14:12 UTC (permalink / raw)
To: Pierre Louis Aublin
Cc: Bing Zhao, kernel-janitors, John W. Linville, linux-wireless,
netdev, linux-kernel
On Mon, 22 Aug 2011, Pierre Louis Aublin wrote:
> Hello all
>
> On 08/22/2011 04:00 PM, Julia Lawall wrote:
> > - if (!bss_desc) {
> > + if (!beacon_ie) {
> > dev_err(priv->adapter->dev, " failed to alloc bss_desc\n");
> Shouldn't we also modify the error message, from "failed to alloc bss_desc" to
> "failed to alloc beacon_ie" ?
Sure :)
julia
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH 4/4] drivers/net/wireless/mwifiex/scan.c: test the
@ 2011-08-22 14:12 ` Julia Lawall
0 siblings, 0 replies; 26+ messages in thread
From: Julia Lawall @ 2011-08-22 14:12 UTC (permalink / raw)
To: Pierre Louis Aublin
Cc: Bing Zhao, kernel-janitors, John W. Linville, linux-wireless,
netdev, linux-kernel
On Mon, 22 Aug 2011, Pierre Louis Aublin wrote:
> Hello all
>
> On 08/22/2011 04:00 PM, Julia Lawall wrote:
> > - if (!bss_desc) {
> > + if (!beacon_ie) {
> > dev_err(priv->adapter->dev, " failed to alloc bss_desc\n");
> Shouldn't we also modify the error message, from "failed to alloc bss_desc" to
> "failed to alloc beacon_ie" ?
Sure :)
julia
^ permalink raw reply [flat|nested] 26+ messages in thread
* [PATCH 4/4] drivers/net/wireless/mwifiex/scan.c: test the just-initialized value
@ 2011-08-22 14:16 ` Julia Lawall
0 siblings, 0 replies; 26+ messages in thread
From: Julia Lawall @ 2011-08-22 14:16 UTC (permalink / raw)
To: Pierre Louis Aublin
Cc: Bing Zhao, kernel-janitors, John W. Linville, linux-wireless,
netdev, linux-kernel
From: Julia Lawall <julia@diku.dk>
Test the just-initialized value rather than some other one.
The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@r@
identifier x,y,f!={PTR_ERR,ERR_PTR,ERR_CAST};
statement S;
@@
x = f(...);
(
if (\(x == NULL\|IS_ERR(x)\)) S
|
*if (\(y == NULL\|IS_ERR(y)\))
{ ... when != x
return ...; }
)
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
---
drivers/net/wireless/mwifiex/scan.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/mwifiex/scan.c b/drivers/net/wireless/mwifiex/scan.c
index b28241c..37ca2f9 100644
--- a/drivers/net/wireless/mwifiex/scan.c
+++ b/drivers/net/wireless/mwifiex/scan.c
@@ -1480,8 +1480,8 @@ mwifiex_update_curr_bss_params(struct mwifiex_private *priv,
return -ENOMEM;
}
beacon_ie = kzalloc(ie_len, GFP_KERNEL);
- if (!bss_desc) {
- dev_err(priv->adapter->dev, " failed to alloc bss_desc\n");
+ if (!beacon_ie) {
+ dev_err(priv->adapter->dev, " failed to alloc beacon_ie\n");
return -ENOMEM;
}
memcpy(beacon_ie, ie_buf, ie_len);
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH 4/4] drivers/net/wireless/mwifiex/scan.c: test the just-initialized value
@ 2011-08-22 14:16 ` Julia Lawall
0 siblings, 0 replies; 26+ messages in thread
From: Julia Lawall @ 2011-08-22 14:16 UTC (permalink / raw)
To: Pierre Louis Aublin
Cc: Bing Zhao, kernel-janitors-u79uwXL29TY76Z2rM5mHXA,
John W. Linville, linux-wireless-u79uwXL29TY76Z2rM5mHXA,
netdev-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
From: Julia Lawall <julia-dAYI7NvHqcQ@public.gmane.org>
Test the just-initialized value rather than some other one.
The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@r@
identifier x,y,f!={PTR_ERR,ERR_PTR,ERR_CAST};
statement S;
@@
x = f(...);
(
if (\(x == NULL\|IS_ERR(x)\)) S
|
*if (\(y == NULL\|IS_ERR(y)\))
{ ... when != x
return ...; }
)
// </smpl>
Signed-off-by: Julia Lawall <julia-dAYI7NvHqcQ@public.gmane.org>
---
drivers/net/wireless/mwifiex/scan.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/mwifiex/scan.c b/drivers/net/wireless/mwifiex/scan.c
index b28241c..37ca2f9 100644
--- a/drivers/net/wireless/mwifiex/scan.c
+++ b/drivers/net/wireless/mwifiex/scan.c
@@ -1480,8 +1480,8 @@ mwifiex_update_curr_bss_params(struct mwifiex_private *priv,
return -ENOMEM;
}
beacon_ie = kzalloc(ie_len, GFP_KERNEL);
- if (!bss_desc) {
- dev_err(priv->adapter->dev, " failed to alloc bss_desc\n");
+ if (!beacon_ie) {
+ dev_err(priv->adapter->dev, " failed to alloc beacon_ie\n");
return -ENOMEM;
}
memcpy(beacon_ie, ie_buf, ie_len);
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH 4/4] drivers/net/wireless/mwifiex/scan.c: test the just-initialized
@ 2011-08-22 14:16 ` Julia Lawall
0 siblings, 0 replies; 26+ messages in thread
From: Julia Lawall @ 2011-08-22 14:16 UTC (permalink / raw)
To: Pierre Louis Aublin
Cc: Bing Zhao, kernel-janitors, John W. Linville, linux-wireless,
netdev, linux-kernel
From: Julia Lawall <julia@diku.dk>
Test the just-initialized value rather than some other one.
The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@r@
identifier x,y,f!={PTR_ERR,ERR_PTR,ERR_CAST};
statement S;
@@
x = f(...);
(
if (\(x = NULL\|IS_ERR(x)\)) S
|
*if (\(y = NULL\|IS_ERR(y)\))
{ ... when != x
return ...; }
)
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
---
drivers/net/wireless/mwifiex/scan.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/mwifiex/scan.c b/drivers/net/wireless/mwifiex/scan.c
index b28241c..37ca2f9 100644
--- a/drivers/net/wireless/mwifiex/scan.c
+++ b/drivers/net/wireless/mwifiex/scan.c
@@ -1480,8 +1480,8 @@ mwifiex_update_curr_bss_params(struct mwifiex_private *priv,
return -ENOMEM;
}
beacon_ie = kzalloc(ie_len, GFP_KERNEL);
- if (!bss_desc) {
- dev_err(priv->adapter->dev, " failed to alloc bss_desc\n");
+ if (!beacon_ie) {
+ dev_err(priv->adapter->dev, " failed to alloc beacon_ie\n");
return -ENOMEM;
}
memcpy(beacon_ie, ie_buf, ie_len);
^ permalink raw reply related [flat|nested] 26+ messages in thread
* Re: [PATCH 4/4] drivers/net/wireless/mwifiex/scan.c: test the just-initialized value
2011-08-22 14:00 ` Julia Lawall
@ 2011-08-22 15:19 ` Larry Finger
-1 siblings, 0 replies; 26+ messages in thread
From: Larry Finger @ 2011-08-22 15:19 UTC (permalink / raw)
To: Julia Lawall
Cc: Bing Zhao, kernel-janitors, John W. Linville, linux-wireless,
netdev, linux-kernel
On 08/22/2011 09:00 AM, Julia Lawall wrote:
> From: Julia Lawall<julia@diku.dk>
>
> Test the just-initialized value rather than some other one.
>
> The semantic match that finds this problem is as follows:
> (http://coccinelle.lip6.fr/)
>
> //<smpl>
> @r@
> identifier x,y,f!={PTR_ERR,ERR_PTR,ERR_CAST};
> statement S;
> @@
>
> x = f(...);
> (
> if (\(x == NULL\|IS_ERR(x)\)) S
> |
> *if (\(y == NULL\|IS_ERR(y)\))
> { ... when != x
> return ...; }
> )
> //</smpl>
>
> Signed-off-by: Julia Lawall<julia@diku.dk>
>
> ---
> drivers/net/wireless/mwifiex/scan.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/mwifiex/scan.c b/drivers/net/wireless/mwifiex/scan.c
> index b28241c..d3111c9 100644
> --- a/drivers/net/wireless/mwifiex/scan.c
> +++ b/drivers/net/wireless/mwifiex/scan.c
> @@ -1480,7 +1480,7 @@ mwifiex_update_curr_bss_params(struct mwifiex_private *priv,
> return -ENOMEM;
> }
> beacon_ie = kzalloc(ie_len, GFP_KERNEL);
> - if (!bss_desc) {
> + if (!beacon_ie) {
> dev_err(priv->adapter->dev, " failed to alloc bss_desc\n");
> return -ENOMEM;
> }
The error message should also get the bss_desc => beacon_ie chang.
Larry
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH 4/4] drivers/net/wireless/mwifiex/scan.c: test the just-initialized
@ 2011-08-22 15:19 ` Larry Finger
0 siblings, 0 replies; 26+ messages in thread
From: Larry Finger @ 2011-08-22 15:19 UTC (permalink / raw)
To: Julia Lawall
Cc: Bing Zhao, kernel-janitors, John W. Linville, linux-wireless,
netdev, linux-kernel
On 08/22/2011 09:00 AM, Julia Lawall wrote:
> From: Julia Lawall<julia@diku.dk>
>
> Test the just-initialized value rather than some other one.
>
> The semantic match that finds this problem is as follows:
> (http://coccinelle.lip6.fr/)
>
> //<smpl>
> @r@
> identifier x,y,f!={PTR_ERR,ERR_PTR,ERR_CAST};
> statement S;
> @@
>
> x = f(...);
> (
> if (\(x = NULL\|IS_ERR(x)\)) S
> |
> *if (\(y = NULL\|IS_ERR(y)\))
> { ... when != x
> return ...; }
> )
> //</smpl>
>
> Signed-off-by: Julia Lawall<julia@diku.dk>
>
> ---
> drivers/net/wireless/mwifiex/scan.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/mwifiex/scan.c b/drivers/net/wireless/mwifiex/scan.c
> index b28241c..d3111c9 100644
> --- a/drivers/net/wireless/mwifiex/scan.c
> +++ b/drivers/net/wireless/mwifiex/scan.c
> @@ -1480,7 +1480,7 @@ mwifiex_update_curr_bss_params(struct mwifiex_private *priv,
> return -ENOMEM;
> }
> beacon_ie = kzalloc(ie_len, GFP_KERNEL);
> - if (!bss_desc) {
> + if (!beacon_ie) {
> dev_err(priv->adapter->dev, " failed to alloc bss_desc\n");
> return -ENOMEM;
> }
The error message should also get the bss_desc => beacon_ie chang.
Larry
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH 4/4] drivers/net/wireless/mwifiex/scan.c: test the just-initialized value
2011-08-22 15:19 ` [PATCH 4/4] drivers/net/wireless/mwifiex/scan.c: test the just-initialized Larry Finger
@ 2011-08-22 15:28 ` Julia Lawall
-1 siblings, 0 replies; 26+ messages in thread
From: Julia Lawall @ 2011-08-22 15:28 UTC (permalink / raw)
To: Larry Finger
Cc: Bing Zhao, kernel-janitors, John W. Linville, linux-wireless,
netdev, linux-kernel
On Mon, 22 Aug 2011, Larry Finger wrote:
> On 08/22/2011 09:00 AM, Julia Lawall wrote:
> > From: Julia Lawall<julia@diku.dk>
> >
> > Test the just-initialized value rather than some other one.
> >
> > The semantic match that finds this problem is as follows:
> > (http://coccinelle.lip6.fr/)
> >
> > //<smpl>
> > @r@
> > identifier x,y,f!={PTR_ERR,ERR_PTR,ERR_CAST};
> > statement S;
> > @@
> >
> > x = f(...);
> > (
> > if (\(x == NULL\|IS_ERR(x)\)) S
> > |
> > *if (\(y == NULL\|IS_ERR(y)\))
> > { ... when != x
> > return ...; }
> > )
> > //</smpl>
> >
> > Signed-off-by: Julia Lawall<julia@diku.dk>
> >
> > ---
> > drivers/net/wireless/mwifiex/scan.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/wireless/mwifiex/scan.c
> > b/drivers/net/wireless/mwifiex/scan.c
> > index b28241c..d3111c9 100644
> > --- a/drivers/net/wireless/mwifiex/scan.c
> > +++ b/drivers/net/wireless/mwifiex/scan.c
> > @@ -1480,7 +1480,7 @@ mwifiex_update_curr_bss_params(struct mwifiex_private
> > *priv,
> > return -ENOMEM;
> > }
> > beacon_ie = kzalloc(ie_len, GFP_KERNEL);
> > - if (!bss_desc) {
> > + if (!beacon_ie) {
> > dev_err(priv->adapter->dev, " failed to alloc bss_desc\n");
> > return -ENOMEM;
> > }
>
> The error message should also get the bss_desc => beacon_ie chang.
Thanks. Pierre Louis Aublin made the same observation and I resumitted
the patch.
julia
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH 4/4] drivers/net/wireless/mwifiex/scan.c: test the
@ 2011-08-22 15:28 ` Julia Lawall
0 siblings, 0 replies; 26+ messages in thread
From: Julia Lawall @ 2011-08-22 15:28 UTC (permalink / raw)
To: Larry Finger
Cc: Bing Zhao, kernel-janitors, John W. Linville, linux-wireless,
netdev, linux-kernel
On Mon, 22 Aug 2011, Larry Finger wrote:
> On 08/22/2011 09:00 AM, Julia Lawall wrote:
> > From: Julia Lawall<julia@diku.dk>
> >
> > Test the just-initialized value rather than some other one.
> >
> > The semantic match that finds this problem is as follows:
> > (http://coccinelle.lip6.fr/)
> >
> > //<smpl>
> > @r@
> > identifier x,y,f!={PTR_ERR,ERR_PTR,ERR_CAST};
> > statement S;
> > @@
> >
> > x = f(...);
> > (
> > if (\(x = NULL\|IS_ERR(x)\)) S
> > |
> > *if (\(y = NULL\|IS_ERR(y)\))
> > { ... when != x
> > return ...; }
> > )
> > //</smpl>
> >
> > Signed-off-by: Julia Lawall<julia@diku.dk>
> >
> > ---
> > drivers/net/wireless/mwifiex/scan.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/wireless/mwifiex/scan.c
> > b/drivers/net/wireless/mwifiex/scan.c
> > index b28241c..d3111c9 100644
> > --- a/drivers/net/wireless/mwifiex/scan.c
> > +++ b/drivers/net/wireless/mwifiex/scan.c
> > @@ -1480,7 +1480,7 @@ mwifiex_update_curr_bss_params(struct mwifiex_private
> > *priv,
> > return -ENOMEM;
> > }
> > beacon_ie = kzalloc(ie_len, GFP_KERNEL);
> > - if (!bss_desc) {
> > + if (!beacon_ie) {
> > dev_err(priv->adapter->dev, " failed to alloc bss_desc\n");
> > return -ENOMEM;
> > }
>
> The error message should also get the bss_desc => beacon_ie chang.
Thanks. Pierre Louis Aublin made the same observation and I resumitted
the patch.
julia
^ permalink raw reply [flat|nested] 26+ messages in thread
* RE: [PATCH 4/4] drivers/net/wireless/mwifiex/scan.c: test the just-initialized value
2011-08-22 14:16 ` [PATCH 4/4] drivers/net/wireless/mwifiex/scan.c: test the just-initialized value Julia Lawall
@ 2011-08-22 19:02 ` Bing Zhao
-1 siblings, 0 replies; 26+ messages in thread
From: Bing Zhao @ 2011-08-22 19:02 UTC (permalink / raw)
To: Julia Lawall, Pierre Louis Aublin
Cc: kernel-janitors, John W. Linville, linux-wireless, netdev, linux-kernel
Hi Julia,
Thanks for the patch.
> -----Original Message-----
> From: Julia Lawall [mailto:julia@diku.dk]
> Sent: Monday, August 22, 2011 7:16 AM
> To: Pierre Louis Aublin
> Cc: Bing Zhao; kernel-janitors@vger.kernel.org; John W. Linville; linux-wireless@vger.kernel.org;
> netdev@vger.kernel.org; linux-kernel@vger.kernel.org
> Subject: [PATCH 4/4] drivers/net/wireless/mwifiex/scan.c: test the just-initialized value
>
> From: Julia Lawall <julia@diku.dk>
>
> Test the just-initialized value rather than some other one.
>
> The semantic match that finds this problem is as follows:
> (http://coccinelle.lip6.fr/)
>
> // <smpl>
> @r@
> identifier x,y,f!={PTR_ERR,ERR_PTR,ERR_CAST};
> statement S;
> @@
>
> x = f(...);
> (
> if (\(x == NULL\|IS_ERR(x)\)) S
> |
> *if (\(y == NULL\|IS_ERR(y)\))
> { ... when != x
> return ...; }
> )
> // </smpl>
>
> Signed-off-by: Julia Lawall <julia@diku.dk>
Acked-by: Bing Zhao <bzhao@marvell.com>
Thanks,
Bing
>
> ---
> drivers/net/wireless/mwifiex/scan.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/wireless/mwifiex/scan.c b/drivers/net/wireless/mwifiex/scan.c
> index b28241c..37ca2f9 100644
> --- a/drivers/net/wireless/mwifiex/scan.c
> +++ b/drivers/net/wireless/mwifiex/scan.c
> @@ -1480,8 +1480,8 @@ mwifiex_update_curr_bss_params(struct mwifiex_private *priv,
> return -ENOMEM;
> }
> beacon_ie = kzalloc(ie_len, GFP_KERNEL);
> - if (!bss_desc) {
> - dev_err(priv->adapter->dev, " failed to alloc bss_desc\n");
> + if (!beacon_ie) {
> + dev_err(priv->adapter->dev, " failed to alloc beacon_ie\n");
> return -ENOMEM;
> }
> memcpy(beacon_ie, ie_buf, ie_len);
^ permalink raw reply [flat|nested] 26+ messages in thread
* RE: [PATCH 4/4] drivers/net/wireless/mwifiex/scan.c: test the
@ 2011-08-22 19:02 ` Bing Zhao
0 siblings, 0 replies; 26+ messages in thread
From: Bing Zhao @ 2011-08-22 19:02 UTC (permalink / raw)
To: Julia Lawall, Pierre Louis Aublin
Cc: kernel-janitors, John W. Linville, linux-wireless, netdev, linux-kernel
Hi Julia,
Thanks for the patch.
> -----Original Message-----
> From: Julia Lawall [mailto:julia@diku.dk]
> Sent: Monday, August 22, 2011 7:16 AM
> To: Pierre Louis Aublin
> Cc: Bing Zhao; kernel-janitors@vger.kernel.org; John W. Linville; linux-wireless@vger.kernel.org;
> netdev@vger.kernel.org; linux-kernel@vger.kernel.org
> Subject: [PATCH 4/4] drivers/net/wireless/mwifiex/scan.c: test the just-initialized value
>
> From: Julia Lawall <julia@diku.dk>
>
> Test the just-initialized value rather than some other one.
>
> The semantic match that finds this problem is as follows:
> (http://coccinelle.lip6.fr/)
>
> // <smpl>
> @r@
> identifier x,y,f!={PTR_ERR,ERR_PTR,ERR_CAST};
> statement S;
> @@
>
> x = f(...);
> (
> if (\(x = NULL\|IS_ERR(x)\)) S
> |
> *if (\(y = NULL\|IS_ERR(y)\))
> { ... when != x
> return ...; }
> )
> // </smpl>
>
> Signed-off-by: Julia Lawall <julia@diku.dk>
Acked-by: Bing Zhao <bzhao@marvell.com>
Thanks,
Bing
>
> ---
> drivers/net/wireless/mwifiex/scan.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/wireless/mwifiex/scan.c b/drivers/net/wireless/mwifiex/scan.c
> index b28241c..37ca2f9 100644
> --- a/drivers/net/wireless/mwifiex/scan.c
> +++ b/drivers/net/wireless/mwifiex/scan.c
> @@ -1480,8 +1480,8 @@ mwifiex_update_curr_bss_params(struct mwifiex_private *priv,
> return -ENOMEM;
> }
> beacon_ie = kzalloc(ie_len, GFP_KERNEL);
> - if (!bss_desc) {
> - dev_err(priv->adapter->dev, " failed to alloc bss_desc\n");
> + if (!beacon_ie) {
> + dev_err(priv->adapter->dev, " failed to alloc beacon_ie\n");
> return -ENOMEM;
> }
> memcpy(beacon_ie, ie_buf, ie_len);
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH 4/4] drivers/net/wireless/mwifiex/scan.c: test the just-initialized value
@ 2011-08-22 19:09 ` walter harms
0 siblings, 0 replies; 26+ messages in thread
From: walter harms @ 2011-08-22 19:09 UTC (permalink / raw)
To: Bing Zhao
Cc: Julia Lawall, Pierre Louis Aublin, kernel-janitors,
John W. Linville, linux-wireless, netdev, linux-kernel
Am 22.08.2011 21:02, schrieb Bing Zhao:
> Hi Julia,
>
> Thanks for the patch.
>
>> -----Original Message-----
>> From: Julia Lawall [mailto:julia@diku.dk]
>> Sent: Monday, August 22, 2011 7:16 AM
>> To: Pierre Louis Aublin
>> Cc: Bing Zhao; kernel-janitors@vger.kernel.org; John W. Linville; linux-wireless@vger.kernel.org;
>> netdev@vger.kernel.org; linux-kernel@vger.kernel.org
>> Subject: [PATCH 4/4] drivers/net/wireless/mwifiex/scan.c: test the just-initialized value
>>
>> From: Julia Lawall <julia@diku.dk>
>>
>> Test the just-initialized value rather than some other one.
>>
>> The semantic match that finds this problem is as follows:
>> (http://coccinelle.lip6.fr/)
>>
>> // <smpl>
>> @r@
>> identifier x,y,f!={PTR_ERR,ERR_PTR,ERR_CAST};
>> statement S;
>> @@
>>
>> x = f(...);
>> (
>> if (\(x == NULL\|IS_ERR(x)\)) S
>> |
>> *if (\(y == NULL\|IS_ERR(y)\))
>> { ... when != x
>> return ...; }
>> )
>> // </smpl>
>>
>> Signed-off-by: Julia Lawall <julia@diku.dk>
>
> Acked-by: Bing Zhao <bzhao@marvell.com>
>
>
> Thanks,
> Bing
>
>>
>> ---
>> drivers/net/wireless/mwifiex/scan.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/net/wireless/mwifiex/scan.c b/drivers/net/wireless/mwifiex/scan.c
>> index b28241c..37ca2f9 100644
>> --- a/drivers/net/wireless/mwifiex/scan.c
>> +++ b/drivers/net/wireless/mwifiex/scan.c
>> @@ -1480,8 +1480,8 @@ mwifiex_update_curr_bss_params(struct mwifiex_private *priv,
>> return -ENOMEM;
>> }
>> beacon_ie = kzalloc(ie_len, GFP_KERNEL);
>> - if (!bss_desc) {
>> - dev_err(priv->adapter->dev, " failed to alloc bss_desc\n");
>> + if (!beacon_ie) {
>> + dev_err(priv->adapter->dev, " failed to alloc beacon_ie\n");
>> return -ENOMEM;
>> }
>> memcpy(beacon_ie, ie_buf, ie_len);
> --
this looks like a case for kmemdup()
just my 2 cents,
re,
wh
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH 4/4] drivers/net/wireless/mwifiex/scan.c: test the just-initialized value
@ 2011-08-22 19:09 ` walter harms
0 siblings, 0 replies; 26+ messages in thread
From: walter harms @ 2011-08-22 19:09 UTC (permalink / raw)
To: Bing Zhao
Cc: Julia Lawall, Pierre Louis Aublin,
kernel-janitors-u79uwXL29TY76Z2rM5mHXA, John W. Linville,
linux-wireless-u79uwXL29TY76Z2rM5mHXA,
netdev-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
Am 22.08.2011 21:02, schrieb Bing Zhao:
> Hi Julia,
>
> Thanks for the patch.
>
>> -----Original Message-----
>> From: Julia Lawall [mailto:julia-dAYI7NvHqcQ@public.gmane.org]
>> Sent: Monday, August 22, 2011 7:16 AM
>> To: Pierre Louis Aublin
>> Cc: Bing Zhao; kernel-janitors-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; John W. Linville; linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org;
>> netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
>> Subject: [PATCH 4/4] drivers/net/wireless/mwifiex/scan.c: test the just-initialized value
>>
>> From: Julia Lawall <julia-dAYI7NvHqcQ@public.gmane.org>
>>
>> Test the just-initialized value rather than some other one.
>>
>> The semantic match that finds this problem is as follows:
>> (http://coccinelle.lip6.fr/)
>>
>> // <smpl>
>> @r@
>> identifier x,y,f!={PTR_ERR,ERR_PTR,ERR_CAST};
>> statement S;
>> @@
>>
>> x = f(...);
>> (
>> if (\(x == NULL\|IS_ERR(x)\)) S
>> |
>> *if (\(y == NULL\|IS_ERR(y)\))
>> { ... when != x
>> return ...; }
>> )
>> // </smpl>
>>
>> Signed-off-by: Julia Lawall <julia-dAYI7NvHqcQ@public.gmane.org>
>
> Acked-by: Bing Zhao <bzhao-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
>
>
> Thanks,
> Bing
>
>>
>> ---
>> drivers/net/wireless/mwifiex/scan.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/net/wireless/mwifiex/scan.c b/drivers/net/wireless/mwifiex/scan.c
>> index b28241c..37ca2f9 100644
>> --- a/drivers/net/wireless/mwifiex/scan.c
>> +++ b/drivers/net/wireless/mwifiex/scan.c
>> @@ -1480,8 +1480,8 @@ mwifiex_update_curr_bss_params(struct mwifiex_private *priv,
>> return -ENOMEM;
>> }
>> beacon_ie = kzalloc(ie_len, GFP_KERNEL);
>> - if (!bss_desc) {
>> - dev_err(priv->adapter->dev, " failed to alloc bss_desc\n");
>> + if (!beacon_ie) {
>> + dev_err(priv->adapter->dev, " failed to alloc beacon_ie\n");
>> return -ENOMEM;
>> }
>> memcpy(beacon_ie, ie_buf, ie_len);
> --
this looks like a case for kmemdup()
just my 2 cents,
re,
wh
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH 4/4] drivers/net/wireless/mwifiex/scan.c: test the just-initialized
@ 2011-08-22 19:09 ` walter harms
0 siblings, 0 replies; 26+ messages in thread
From: walter harms @ 2011-08-22 19:09 UTC (permalink / raw)
To: Bing Zhao
Cc: Julia Lawall, Pierre Louis Aublin, kernel-janitors,
John W. Linville, linux-wireless, netdev, linux-kernel
Am 22.08.2011 21:02, schrieb Bing Zhao:
> Hi Julia,
>
> Thanks for the patch.
>
>> -----Original Message-----
>> From: Julia Lawall [mailto:julia@diku.dk]
>> Sent: Monday, August 22, 2011 7:16 AM
>> To: Pierre Louis Aublin
>> Cc: Bing Zhao; kernel-janitors@vger.kernel.org; John W. Linville; linux-wireless@vger.kernel.org;
>> netdev@vger.kernel.org; linux-kernel@vger.kernel.org
>> Subject: [PATCH 4/4] drivers/net/wireless/mwifiex/scan.c: test the just-initialized value
>>
>> From: Julia Lawall <julia@diku.dk>
>>
>> Test the just-initialized value rather than some other one.
>>
>> The semantic match that finds this problem is as follows:
>> (http://coccinelle.lip6.fr/)
>>
>> // <smpl>
>> @r@
>> identifier x,y,f!={PTR_ERR,ERR_PTR,ERR_CAST};
>> statement S;
>> @@
>>
>> x = f(...);
>> (
>> if (\(x = NULL\|IS_ERR(x)\)) S
>> |
>> *if (\(y = NULL\|IS_ERR(y)\))
>> { ... when != x
>> return ...; }
>> )
>> // </smpl>
>>
>> Signed-off-by: Julia Lawall <julia@diku.dk>
>
> Acked-by: Bing Zhao <bzhao@marvell.com>
>
>
> Thanks,
> Bing
>
>>
>> ---
>> drivers/net/wireless/mwifiex/scan.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/net/wireless/mwifiex/scan.c b/drivers/net/wireless/mwifiex/scan.c
>> index b28241c..37ca2f9 100644
>> --- a/drivers/net/wireless/mwifiex/scan.c
>> +++ b/drivers/net/wireless/mwifiex/scan.c
>> @@ -1480,8 +1480,8 @@ mwifiex_update_curr_bss_params(struct mwifiex_private *priv,
>> return -ENOMEM;
>> }
>> beacon_ie = kzalloc(ie_len, GFP_KERNEL);
>> - if (!bss_desc) {
>> - dev_err(priv->adapter->dev, " failed to alloc bss_desc\n");
>> + if (!beacon_ie) {
>> + dev_err(priv->adapter->dev, " failed to alloc beacon_ie\n");
>> return -ENOMEM;
>> }
>> memcpy(beacon_ie, ie_buf, ie_len);
> --
this looks like a case for kmemdup()
just my 2 cents,
re,
wh
^ permalink raw reply [flat|nested] 26+ messages in thread
* RE: [PATCH 4/4] drivers/net/wireless/mwifiex/scan.c: test the just-initialized value
@ 2011-08-22 19:29 ` Bing Zhao
0 siblings, 0 replies; 26+ messages in thread
From: Bing Zhao @ 2011-08-22 19:29 UTC (permalink / raw)
To: wharms
Cc: Julia Lawall, Pierre Louis Aublin, kernel-janitors,
John W. Linville, linux-wireless, netdev, linux-kernel
> Am 22.08.2011 21:02, schrieb Bing Zhao:
> > Hi Julia,
> >
> > Thanks for the patch.
> >
> >> -----Original Message-----
> >> From: Julia Lawall [mailto:julia@diku.dk]
> >> Sent: Monday, August 22, 2011 7:16 AM
> >> To: Pierre Louis Aublin
> >> Cc: Bing Zhao; kernel-janitors@vger.kernel.org; John W. Linville; linux-wireless@vger.kernel.org;
> >> netdev@vger.kernel.org; linux-kernel@vger.kernel.org
> >> Subject: [PATCH 4/4] drivers/net/wireless/mwifiex/scan.c: test the just-initialized value
> >>
> >> From: Julia Lawall <julia@diku.dk>
> >>
> >> Test the just-initialized value rather than some other one.
> >>
> >> The semantic match that finds this problem is as follows:
> >> (http://coccinelle.lip6.fr/)
> >>
> >> // <smpl>
> >> @r@
> >> identifier x,y,f!={PTR_ERR,ERR_PTR,ERR_CAST};
> >> statement S;
> >> @@
> >>
> >> x = f(...);
> >> (
> >> if (\(x == NULL\|IS_ERR(x)\)) S
> >> |
> >> *if (\(y == NULL\|IS_ERR(y)\))
> >> { ... when != x
> >> return ...; }
> >> )
> >> // </smpl>
> >>
> >> Signed-off-by: Julia Lawall <julia@diku.dk>
> >
> > Acked-by: Bing Zhao <bzhao@marvell.com>
> >
> >
> > Thanks,
> > Bing
> >
> >>
> >> ---
> >> drivers/net/wireless/mwifiex/scan.c | 4 ++--
> >> 1 file changed, 2 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/drivers/net/wireless/mwifiex/scan.c b/drivers/net/wireless/mwifiex/scan.c
> >> index b28241c..37ca2f9 100644
> >> --- a/drivers/net/wireless/mwifiex/scan.c
> >> +++ b/drivers/net/wireless/mwifiex/scan.c
> >> @@ -1480,8 +1480,8 @@ mwifiex_update_curr_bss_params(struct mwifiex_private *priv,
> >> return -ENOMEM;
> >> }
> >> beacon_ie = kzalloc(ie_len, GFP_KERNEL);
> >> - if (!bss_desc) {
> >> - dev_err(priv->adapter->dev, " failed to alloc bss_desc\n");
> >> + if (!beacon_ie) {
> >> + dev_err(priv->adapter->dev, " failed to alloc beacon_ie\n");
> >> return -ENOMEM;
> >> }
> >> memcpy(beacon_ie, ie_buf, ie_len);
> > --
>
>
> this looks like a case for kmemdup()
Hi Walter,
You are right. I believe there are some more cases where kmemdup can be used.
Hi John,
Please apply Julia's patch as I will send a separate patch later to address Walter's comment. Thanks.
>
> just my 2 cents,
Thanks a lot for your 2 cents.
Bing
>
> re,
> wh
>
^ permalink raw reply [flat|nested] 26+ messages in thread
* RE: [PATCH 4/4] drivers/net/wireless/mwifiex/scan.c: test the just-initialized value
@ 2011-08-22 19:29 ` Bing Zhao
0 siblings, 0 replies; 26+ messages in thread
From: Bing Zhao @ 2011-08-22 19:29 UTC (permalink / raw)
To: wharms-fPG8STNUNVg
Cc: Julia Lawall, Pierre Louis Aublin,
kernel-janitors-u79uwXL29TY76Z2rM5mHXA, John W. Linville,
linux-wireless-u79uwXL29TY76Z2rM5mHXA,
netdev-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
> Am 22.08.2011 21:02, schrieb Bing Zhao:
> > Hi Julia,
> >
> > Thanks for the patch.
> >
> >> -----Original Message-----
> >> From: Julia Lawall [mailto:julia-dAYI7NvHqcQ@public.gmane.org]
> >> Sent: Monday, August 22, 2011 7:16 AM
> >> To: Pierre Louis Aublin
> >> Cc: Bing Zhao; kernel-janitors-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; John W. Linville; linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org;
> >> netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> >> Subject: [PATCH 4/4] drivers/net/wireless/mwifiex/scan.c: test the just-initialized value
> >>
> >> From: Julia Lawall <julia-dAYI7NvHqcQ@public.gmane.org>
> >>
> >> Test the just-initialized value rather than some other one.
> >>
> >> The semantic match that finds this problem is as follows:
> >> (http://coccinelle.lip6.fr/)
> >>
> >> // <smpl>
> >> @r@
> >> identifier x,y,f!={PTR_ERR,ERR_PTR,ERR_CAST};
> >> statement S;
> >> @@
> >>
> >> x = f(...);
> >> (
> >> if (\(x == NULL\|IS_ERR(x)\)) S
> >> |
> >> *if (\(y == NULL\|IS_ERR(y)\))
> >> { ... when != x
> >> return ...; }
> >> )
> >> // </smpl>
> >>
> >> Signed-off-by: Julia Lawall <julia-dAYI7NvHqcQ@public.gmane.org>
> >
> > Acked-by: Bing Zhao <bzhao-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
> >
> >
> > Thanks,
> > Bing
> >
> >>
> >> ---
> >> drivers/net/wireless/mwifiex/scan.c | 4 ++--
> >> 1 file changed, 2 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/drivers/net/wireless/mwifiex/scan.c b/drivers/net/wireless/mwifiex/scan.c
> >> index b28241c..37ca2f9 100644
> >> --- a/drivers/net/wireless/mwifiex/scan.c
> >> +++ b/drivers/net/wireless/mwifiex/scan.c
> >> @@ -1480,8 +1480,8 @@ mwifiex_update_curr_bss_params(struct mwifiex_private *priv,
> >> return -ENOMEM;
> >> }
> >> beacon_ie = kzalloc(ie_len, GFP_KERNEL);
> >> - if (!bss_desc) {
> >> - dev_err(priv->adapter->dev, " failed to alloc bss_desc\n");
> >> + if (!beacon_ie) {
> >> + dev_err(priv->adapter->dev, " failed to alloc beacon_ie\n");
> >> return -ENOMEM;
> >> }
> >> memcpy(beacon_ie, ie_buf, ie_len);
> > --
>
>
> this looks like a case for kmemdup()
Hi Walter,
You are right. I believe there are some more cases where kmemdup can be used.
Hi John,
Please apply Julia's patch as I will send a separate patch later to address Walter's comment. Thanks.
>
> just my 2 cents,
Thanks a lot for your 2 cents.
Bing
>
> re,
> wh
>
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 26+ messages in thread
* RE: [PATCH 4/4] drivers/net/wireless/mwifiex/scan.c: test the
@ 2011-08-22 19:29 ` Bing Zhao
0 siblings, 0 replies; 26+ messages in thread
From: Bing Zhao @ 2011-08-22 19:29 UTC (permalink / raw)
To: wharms
Cc: Julia Lawall, Pierre Louis Aublin, kernel-janitors,
John W. Linville, linux-wireless, netdev, linux-kernel
> Am 22.08.2011 21:02, schrieb Bing Zhao:
> > Hi Julia,
> >
> > Thanks for the patch.
> >
> >> -----Original Message-----
> >> From: Julia Lawall [mailto:julia@diku.dk]
> >> Sent: Monday, August 22, 2011 7:16 AM
> >> To: Pierre Louis Aublin
> >> Cc: Bing Zhao; kernel-janitors@vger.kernel.org; John W. Linville; linux-wireless@vger.kernel.org;
> >> netdev@vger.kernel.org; linux-kernel@vger.kernel.org
> >> Subject: [PATCH 4/4] drivers/net/wireless/mwifiex/scan.c: test the just-initialized value
> >>
> >> From: Julia Lawall <julia@diku.dk>
> >>
> >> Test the just-initialized value rather than some other one.
> >>
> >> The semantic match that finds this problem is as follows:
> >> (http://coccinelle.lip6.fr/)
> >>
> >> // <smpl>
> >> @r@
> >> identifier x,y,f!={PTR_ERR,ERR_PTR,ERR_CAST};
> >> statement S;
> >> @@
> >>
> >> x = f(...);
> >> (
> >> if (\(x = NULL\|IS_ERR(x)\)) S
> >> |
> >> *if (\(y = NULL\|IS_ERR(y)\))
> >> { ... when != x
> >> return ...; }
> >> )
> >> // </smpl>
> >>
> >> Signed-off-by: Julia Lawall <julia@diku.dk>
> >
> > Acked-by: Bing Zhao <bzhao@marvell.com>
> >
> >
> > Thanks,
> > Bing
> >
> >>
> >> ---
> >> drivers/net/wireless/mwifiex/scan.c | 4 ++--
> >> 1 file changed, 2 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/drivers/net/wireless/mwifiex/scan.c b/drivers/net/wireless/mwifiex/scan.c
> >> index b28241c..37ca2f9 100644
> >> --- a/drivers/net/wireless/mwifiex/scan.c
> >> +++ b/drivers/net/wireless/mwifiex/scan.c
> >> @@ -1480,8 +1480,8 @@ mwifiex_update_curr_bss_params(struct mwifiex_private *priv,
> >> return -ENOMEM;
> >> }
> >> beacon_ie = kzalloc(ie_len, GFP_KERNEL);
> >> - if (!bss_desc) {
> >> - dev_err(priv->adapter->dev, " failed to alloc bss_desc\n");
> >> + if (!beacon_ie) {
> >> + dev_err(priv->adapter->dev, " failed to alloc beacon_ie\n");
> >> return -ENOMEM;
> >> }
> >> memcpy(beacon_ie, ie_buf, ie_len);
> > --
>
>
> this looks like a case for kmemdup()
Hi Walter,
You are right. I believe there are some more cases where kmemdup can be used.
Hi John,
Please apply Julia's patch as I will send a separate patch later to address Walter's comment. Thanks.
>
> just my 2 cents,
Thanks a lot for your 2 cents.
Bing
>
> re,
> wh
>
^ permalink raw reply [flat|nested] 26+ messages in thread
* [PATCH 4/4] drivers/net/wireless/mwifiex/scan.c: convert GFP_KERNEL to GFP_ATOMIC
2011-08-22 14:00 ` Julia Lawall
@ 2012-01-09 9:40 ` Julia Lawall
-1 siblings, 0 replies; 26+ messages in thread
From: Julia Lawall @ 2012-01-09 9:40 UTC (permalink / raw)
To: Bing Zhao
Cc: kernel-janitors, John W. Linville, linux-wireless, netdev,
linux-kernel, Julia Lawall
From: Julia Lawall <julia.lawall@lip6.fr>
The function is called with locks held and thus should not use GFP_KERNEL.
The semantic patch that makes this report is available
in scripts/coccinelle/locks/call_kern.cocci.
More information about semantic patching is available at
http://coccinelle.lip6.fr/
Signed-off-by: Julia Lawall <julia.lawall@lip6.fr>
---
drivers/net/wireless/mwifiex/scan.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/wireless/mwifiex/scan.c b/drivers/net/wireless/mwifiex/scan.c
index 6396d33..98f1ca9 100644
--- a/drivers/net/wireless/mwifiex/scan.c
+++ b/drivers/net/wireless/mwifiex/scan.c
@@ -2001,7 +2001,7 @@ mwifiex_save_curr_bcn(struct mwifiex_private *priv)
kfree(priv->curr_bcn_buf);
priv->curr_bcn_buf = kmalloc(curr_bss->beacon_buf_size,
- GFP_KERNEL);
+ GFP_ATOMIC);
if (!priv->curr_bcn_buf) {
dev_err(priv->adapter->dev,
"failed to alloc curr_bcn_buf\n");
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH 4/4] drivers/net/wireless/mwifiex/scan.c: convert GFP_KERNEL to GFP_ATOMIC
@ 2012-01-09 9:40 ` Julia Lawall
0 siblings, 0 replies; 26+ messages in thread
From: Julia Lawall @ 2012-01-09 9:40 UTC (permalink / raw)
To: Bing Zhao
Cc: kernel-janitors, John W. Linville, linux-wireless, netdev,
linux-kernel, Julia Lawall
From: Julia Lawall <julia.lawall@lip6.fr>
The function is called with locks held and thus should not use GFP_KERNEL.
The semantic patch that makes this report is available
in scripts/coccinelle/locks/call_kern.cocci.
More information about semantic patching is available at
http://coccinelle.lip6.fr/
Signed-off-by: Julia Lawall <julia.lawall@lip6.fr>
---
drivers/net/wireless/mwifiex/scan.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/wireless/mwifiex/scan.c b/drivers/net/wireless/mwifiex/scan.c
index 6396d33..98f1ca9 100644
--- a/drivers/net/wireless/mwifiex/scan.c
+++ b/drivers/net/wireless/mwifiex/scan.c
@@ -2001,7 +2001,7 @@ mwifiex_save_curr_bcn(struct mwifiex_private *priv)
kfree(priv->curr_bcn_buf);
priv->curr_bcn_buf = kmalloc(curr_bss->beacon_buf_size,
- GFP_KERNEL);
+ GFP_ATOMIC);
if (!priv->curr_bcn_buf) {
dev_err(priv->adapter->dev,
"failed to alloc curr_bcn_buf\n");
^ permalink raw reply related [flat|nested] 26+ messages in thread
* RE: [PATCH 4/4] drivers/net/wireless/mwifiex/scan.c: convert GFP_KERNEL to GFP_ATOMIC
2012-01-09 9:40 ` Julia Lawall
@ 2012-01-09 18:49 ` Bing Zhao
-1 siblings, 0 replies; 26+ messages in thread
From: Bing Zhao @ 2012-01-09 18:49 UTC (permalink / raw)
To: Julia Lawall
Cc: kernel-janitors, John W. Linville, linux-wireless, netdev, linux-kernel
Hi Julia,
Thanks for the patch.
> Subject: [PATCH 4/4] drivers/net/wireless/mwifiex/scan.c: convert GFP_KERNEL to GFP_ATOMIC
>
> From: Julia Lawall <julia.lawall@lip6.fr>
>
> The function is called with locks held and thus should not use GFP_KERNEL.
>
> The semantic patch that makes this report is available
> in scripts/coccinelle/locks/call_kern.cocci.
>
> More information about semantic patching is available at
> http://coccinelle.lip6.fr/
>
> Signed-off-by: Julia Lawall <julia.lawall@lip6.fr>
Acked-by: Bing Zhao <bzhao@marvell.com>
Regards,
Bing
>
> ---
> drivers/net/wireless/mwifiex/scan.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/mwifiex/scan.c b/drivers/net/wireless/mwifiex/scan.c
> index 6396d33..98f1ca9 100644
> --- a/drivers/net/wireless/mwifiex/scan.c
> +++ b/drivers/net/wireless/mwifiex/scan.c
> @@ -2001,7 +2001,7 @@ mwifiex_save_curr_bcn(struct mwifiex_private *priv)
>
> kfree(priv->curr_bcn_buf);
> priv->curr_bcn_buf = kmalloc(curr_bss->beacon_buf_size,
> - GFP_KERNEL);
> + GFP_ATOMIC);
> if (!priv->curr_bcn_buf) {
> dev_err(priv->adapter->dev,
> "failed to alloc curr_bcn_buf\n");
^ permalink raw reply [flat|nested] 26+ messages in thread
* RE: [PATCH 4/4] drivers/net/wireless/mwifiex/scan.c: convert
@ 2012-01-09 18:49 ` Bing Zhao
0 siblings, 0 replies; 26+ messages in thread
From: Bing Zhao @ 2012-01-09 18:49 UTC (permalink / raw)
To: Julia Lawall
Cc: kernel-janitors, John W. Linville, linux-wireless, netdev, linux-kernel
Hi Julia,
Thanks for the patch.
> Subject: [PATCH 4/4] drivers/net/wireless/mwifiex/scan.c: convert GFP_KERNEL to GFP_ATOMIC
>
> From: Julia Lawall <julia.lawall@lip6.fr>
>
> The function is called with locks held and thus should not use GFP_KERNEL.
>
> The semantic patch that makes this report is available
> in scripts/coccinelle/locks/call_kern.cocci.
>
> More information about semantic patching is available at
> http://coccinelle.lip6.fr/
>
> Signed-off-by: Julia Lawall <julia.lawall@lip6.fr>
Acked-by: Bing Zhao <bzhao@marvell.com>
Regards,
Bing
>
> ---
> drivers/net/wireless/mwifiex/scan.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/mwifiex/scan.c b/drivers/net/wireless/mwifiex/scan.c
> index 6396d33..98f1ca9 100644
> --- a/drivers/net/wireless/mwifiex/scan.c
> +++ b/drivers/net/wireless/mwifiex/scan.c
> @@ -2001,7 +2001,7 @@ mwifiex_save_curr_bcn(struct mwifiex_private *priv)
>
> kfree(priv->curr_bcn_buf);
> priv->curr_bcn_buf = kmalloc(curr_bss->beacon_buf_size,
> - GFP_KERNEL);
> + GFP_ATOMIC);
> if (!priv->curr_bcn_buf) {
> dev_err(priv->adapter->dev,
> "failed to alloc curr_bcn_buf\n");
^ permalink raw reply [flat|nested] 26+ messages in thread
end of thread, other threads:[~2012-01-09 18:51 UTC | newest]
Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-22 14:00 [PATCH 4/4] drivers/net/wireless/mwifiex/scan.c: test the just-initialized value Julia Lawall
2011-08-22 14:00 ` Julia Lawall
2011-08-22 14:00 ` Julia Lawall
2011-08-22 14:11 ` Pierre Louis Aublin
2011-08-22 14:11 ` [PATCH 4/4] drivers/net/wireless/mwifiex/scan.c: test the just-initialized Pierre Louis Aublin
2011-08-22 14:12 ` [PATCH 4/4] drivers/net/wireless/mwifiex/scan.c: test the just-initialized value Julia Lawall
2011-08-22 14:12 ` [PATCH 4/4] drivers/net/wireless/mwifiex/scan.c: test the Julia Lawall
2011-08-22 14:16 ` [PATCH 4/4] drivers/net/wireless/mwifiex/scan.c: test the just-initialized value Julia Lawall
2011-08-22 14:16 ` [PATCH 4/4] drivers/net/wireless/mwifiex/scan.c: test the just-initialized Julia Lawall
2011-08-22 14:16 ` [PATCH 4/4] drivers/net/wireless/mwifiex/scan.c: test the just-initialized value Julia Lawall
2011-08-22 19:02 ` Bing Zhao
2011-08-22 19:02 ` [PATCH 4/4] drivers/net/wireless/mwifiex/scan.c: test the Bing Zhao
2011-08-22 19:09 ` [PATCH 4/4] drivers/net/wireless/mwifiex/scan.c: test the just-initialized value walter harms
2011-08-22 19:09 ` [PATCH 4/4] drivers/net/wireless/mwifiex/scan.c: test the just-initialized walter harms
2011-08-22 19:09 ` [PATCH 4/4] drivers/net/wireless/mwifiex/scan.c: test the just-initialized value walter harms
2011-08-22 19:29 ` Bing Zhao
2011-08-22 19:29 ` [PATCH 4/4] drivers/net/wireless/mwifiex/scan.c: test the Bing Zhao
2011-08-22 19:29 ` [PATCH 4/4] drivers/net/wireless/mwifiex/scan.c: test the just-initialized value Bing Zhao
2011-08-22 15:19 ` Larry Finger
2011-08-22 15:19 ` [PATCH 4/4] drivers/net/wireless/mwifiex/scan.c: test the just-initialized Larry Finger
2011-08-22 15:28 ` [PATCH 4/4] drivers/net/wireless/mwifiex/scan.c: test the just-initialized value Julia Lawall
2011-08-22 15:28 ` [PATCH 4/4] drivers/net/wireless/mwifiex/scan.c: test the Julia Lawall
2012-01-09 9:40 [PATCH 4/4] drivers/net/wireless/mwifiex/scan.c: convert GFP_KERNEL to GFP_ATOMIC Julia Lawall
2012-01-09 9:40 ` Julia Lawall
2012-01-09 18:49 ` Bing Zhao
2012-01-09 18:49 ` [PATCH 4/4] drivers/net/wireless/mwifiex/scan.c: convert Bing Zhao
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.