* [PATCH 1/7] ipvs: fix error return code
[not found] <1346258957-7649-1-git-send-email-Julia.Lawall@lip6.fr>
@ 2012-08-29 16:49 ` Julia Lawall
2012-08-30 1:12 ` Simon Horman
2012-08-30 1:34 ` Pablo Neira Ayuso
2012-08-29 16:49 ` [PATCH 7/7] net/netfilter/nf_conntrack_netlink.c: " Julia Lawall
2012-08-29 16:49 ` [PATCH 6/7] net/netfilter/nfnetlink_log.c: " Julia Lawall
2 siblings, 2 replies; 7+ messages in thread
From: Julia Lawall @ 2012-08-29 16:49 UTC (permalink / raw)
To: Wensong Zhang
Cc: kernel-janitors, Simon Horman, Julian Anastasov,
Pablo Neira Ayuso, Patrick McHardy, David S. Miller, netdev,
lvs-devel, netfilter-devel, netfilter, coreteam, linux-kernel
From: Julia Lawall <Julia.Lawall@lip6.fr>
Initialize return variable before exiting on an error path.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
// <smpl>
(
if@p1 (\(ret < 0\|ret != 0\))
{ ... return ret; }
|
ret@p1 = 0
)
... when != ret = e1
when != &ret
*if(...)
{
... when != ret = e2
when forall
return ret;
}
// </smpl>
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
---
net/netfilter/ipvs/ip_vs_ctl.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c
index 3c60137..767cc12 100644
--- a/net/netfilter/ipvs/ip_vs_ctl.c
+++ b/net/netfilter/ipvs/ip_vs_ctl.c
@@ -1171,8 +1171,10 @@ ip_vs_add_service(struct net *net, struct ip_vs_service_user_kern *u,
goto out_err;
}
svc->stats.cpustats = alloc_percpu(struct ip_vs_cpu_stats);
- if (!svc->stats.cpustats)
+ if (!svc->stats.cpustats) {
+ ret = -ENOMEM;
goto out_err;
+ }
/* I'm the first user of the service */
atomic_set(&svc->usecnt, 0);
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/7] ipvs: fix error return code
2012-08-29 16:49 ` [PATCH 1/7] ipvs: fix error return code Julia Lawall
@ 2012-08-30 1:12 ` Simon Horman
2012-08-30 1:34 ` Pablo Neira Ayuso
1 sibling, 0 replies; 7+ messages in thread
From: Simon Horman @ 2012-08-30 1:12 UTC (permalink / raw)
To: Julia Lawall
Cc: Wensong Zhang, kernel-janitors, Julian Anastasov,
Pablo Neira Ayuso, Patrick McHardy, David S. Miller, netdev,
lvs-devel, netfilter-devel, netfilter, coreteam, linux-kernel
On Wed, Aug 29, 2012 at 06:49:11PM +0200, Julia Lawall wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
>
> Initialize return variable before exiting on an error path.
>
> A simplified version of the semantic match that finds this problem is as
> follows: (http://coccinelle.lip6.fr/)
>
> // <smpl>
> (
> if@p1 (\(ret < 0\|ret != 0\))
> { ... return ret; }
> |
> ret@p1 = 0
> )
> ... when != ret = e1
> when != &ret
> *if(...)
> {
> ... when != ret = e2
> when forall
> return ret;
> }
>
> // </smpl>
>
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
>
> ---
> net/netfilter/ipvs/ip_vs_ctl.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c
> index 3c60137..767cc12 100644
> --- a/net/netfilter/ipvs/ip_vs_ctl.c
> +++ b/net/netfilter/ipvs/ip_vs_ctl.c
> @@ -1171,8 +1171,10 @@ ip_vs_add_service(struct net *net, struct ip_vs_service_user_kern *u,
> goto out_err;
> }
> svc->stats.cpustats = alloc_percpu(struct ip_vs_cpu_stats);
> - if (!svc->stats.cpustats)
> + if (!svc->stats.cpustats) {
> + ret = -ENOMEM;
> goto out_err;
> + }
>
> /* I'm the first user of the service */
> atomic_set(&svc->usecnt, 0);
Acked-by: Simon Horman <horms@verge.net.au>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/7] ipvs: fix error return code
2012-08-29 16:49 ` [PATCH 1/7] ipvs: fix error return code Julia Lawall
2012-08-30 1:12 ` Simon Horman
@ 2012-08-30 1:34 ` Pablo Neira Ayuso
1 sibling, 0 replies; 7+ messages in thread
From: Pablo Neira Ayuso @ 2012-08-30 1:34 UTC (permalink / raw)
To: Julia Lawall
Cc: Wensong Zhang, kernel-janitors, Simon Horman, Julian Anastasov,
Patrick McHardy, David S. Miller, netdev, lvs-devel,
netfilter-devel, netfilter, coreteam, linux-kernel
On Wed, Aug 29, 2012 at 06:49:11PM +0200, Julia Lawall wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
>
> Initialize return variable before exiting on an error path.
>
> A simplified version of the semantic match that finds this problem is as
> follows: (http://coccinelle.lip6.fr/)
>
> // <smpl>
> (
> if@p1 (\(ret < 0\|ret != 0\))
> { ... return ret; }
> |
> ret@p1 = 0
> )
> ... when != ret = e1
> when != &ret
> *if(...)
> {
> ... when != ret = e2
> when forall
> return ret;
> }
>
> // </smpl>
Applied. Thanks.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 7/7] net/netfilter/nf_conntrack_netlink.c: fix error return code
[not found] <1346258957-7649-1-git-send-email-Julia.Lawall@lip6.fr>
2012-08-29 16:49 ` [PATCH 1/7] ipvs: fix error return code Julia Lawall
@ 2012-08-29 16:49 ` Julia Lawall
2012-08-30 1:35 ` Pablo Neira Ayuso
2012-08-29 16:49 ` [PATCH 6/7] net/netfilter/nfnetlink_log.c: " Julia Lawall
2 siblings, 1 reply; 7+ messages in thread
From: Julia Lawall @ 2012-08-29 16:49 UTC (permalink / raw)
To: Pablo Neira Ayuso
Cc: kernel-janitors, Patrick McHardy, David S. Miller,
netfilter-devel, netfilter, coreteam, netdev, linux-kernel
From: Julia Lawall <Julia.Lawall@lip6.fr>
Initialize return variable before exiting on an error path.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
// <smpl>
(
if@p1 (\(ret < 0\|ret != 0\))
{ ... return ret; }
|
ret@p1 = 0
)
... when != ret = e1
when != &ret
*if(...)
{
... when != ret = e2
when forall
return ret;
}
// </smpl>
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
---
net/netfilter/nf_conntrack_netlink.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c
index da4fc37..9807f32 100644
--- a/net/netfilter/nf_conntrack_netlink.c
+++ b/net/netfilter/nf_conntrack_netlink.c
@@ -2790,7 +2790,8 @@ static int __init ctnetlink_init(void)
goto err_unreg_subsys;
}
- if (register_pernet_subsys(&ctnetlink_net_ops)) {
+ ret = register_pernet_subsys(&ctnetlink_net_ops);
+ if (ret < 0) {
pr_err("ctnetlink_init: cannot register pernet operations\n");
goto err_unreg_exp_subsys;
}
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 7/7] net/netfilter/nf_conntrack_netlink.c: fix error return code
2012-08-29 16:49 ` [PATCH 7/7] net/netfilter/nf_conntrack_netlink.c: " Julia Lawall
@ 2012-08-30 1:35 ` Pablo Neira Ayuso
0 siblings, 0 replies; 7+ messages in thread
From: Pablo Neira Ayuso @ 2012-08-30 1:35 UTC (permalink / raw)
To: Julia Lawall
Cc: kernel-janitors, Patrick McHardy, David S. Miller,
netfilter-devel, netfilter, coreteam, netdev, linux-kernel
On Wed, Aug 29, 2012 at 06:49:16PM +0200, Julia Lawall wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
>
> Initialize return variable before exiting on an error path.
>
> A simplified version of the semantic match that finds this problem is as
> follows: (http://coccinelle.lip6.fr/)
>
> // <smpl>
> (
> if@p1 (\(ret < 0\|ret != 0\))
> { ... return ret; }
> |
> ret@p1 = 0
> )
> ... when != ret = e1
> when != &ret
> *if(...)
> {
> ... when != ret = e2
> when forall
> return ret;
> }
>
> // </smpl>
Applied, thanks.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 6/7] net/netfilter/nfnetlink_log.c: fix error return code
[not found] <1346258957-7649-1-git-send-email-Julia.Lawall@lip6.fr>
2012-08-29 16:49 ` [PATCH 1/7] ipvs: fix error return code Julia Lawall
2012-08-29 16:49 ` [PATCH 7/7] net/netfilter/nf_conntrack_netlink.c: " Julia Lawall
@ 2012-08-29 16:49 ` Julia Lawall
2012-08-30 1:35 ` Pablo Neira Ayuso
2 siblings, 1 reply; 7+ messages in thread
From: Julia Lawall @ 2012-08-29 16:49 UTC (permalink / raw)
To: Pablo Neira Ayuso
Cc: kernel-janitors, Patrick McHardy, David S. Miller,
netfilter-devel, netfilter, coreteam, netdev, linux-kernel
From: Julia Lawall <Julia.Lawall@lip6.fr>
Initialize return variable before exiting on an error path.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
// <smpl>
(
if@p1 (\(ret < 0\|ret != 0\))
{ ... return ret; }
|
ret@p1 = 0
)
... when != ret = e1
when != &ret
*if(...)
{
... when != ret = e2
when forall
return ret;
}
// </smpl>
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
---
net/netfilter/nfnetlink_log.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c
index 4142aac..9ef5438 100644
--- a/net/netfilter/nfnetlink_log.c
+++ b/net/netfilter/nfnetlink_log.c
@@ -1002,8 +1002,10 @@ static int __init nfnetlink_log_init(void)
#ifdef CONFIG_PROC_FS
if (!proc_create("nfnetlink_log", 0440,
- proc_net_netfilter, &nful_file_ops))
+ proc_net_netfilter, &nful_file_ops)) {
+ status = -ENOMEM;
goto cleanup_logger;
+ }
#endif
return status;
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 6/7] net/netfilter/nfnetlink_log.c: fix error return code
2012-08-29 16:49 ` [PATCH 6/7] net/netfilter/nfnetlink_log.c: " Julia Lawall
@ 2012-08-30 1:35 ` Pablo Neira Ayuso
0 siblings, 0 replies; 7+ messages in thread
From: Pablo Neira Ayuso @ 2012-08-30 1:35 UTC (permalink / raw)
To: Julia Lawall
Cc: kernel-janitors, Patrick McHardy, David S. Miller,
netfilter-devel, netfilter, coreteam, netdev, linux-kernel
On Wed, Aug 29, 2012 at 06:49:17PM +0200, Julia Lawall wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
>
> Initialize return variable before exiting on an error path.
>
> A simplified version of the semantic match that finds this problem is as
> follows: (http://coccinelle.lip6.fr/)
>
> // <smpl>
> (
> if@p1 (\(ret < 0\|ret != 0\))
> { ... return ret; }
> |
> ret@p1 = 0
> )
> ... when != ret = e1
> when != &ret
> *if(...)
> {
> ... when != ret = e2
> when forall
> return ret;
> }
>
> // </smpl>
And also applied, thanks Julia. I'll pass these to current -rc.
^ permalink raw reply [flat|nested] 7+ messages in thread