From: Julia Lawall <hidden> Date: 2012-08-29 16:50:07
From: Julia Lawall <redacted>
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 <redacted>
---
net/netfilter/ipvs/ip_vs_ctl.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
@@ -1171,8 +1171,10 @@ ip_vs_add_service(struct net *net, struct ip_vs_service_user_kern *u,gotoout_err;}svc->stats.cpustats=alloc_percpu(structip_vs_cpu_stats);-if(!svc->stats.cpustats)+if(!svc->stats.cpustats){+ret=-ENOMEM;gotoout_err;+}/* I'm the first user of the service */atomic_set(&svc->usecnt,0);
From: Simon Horman <horms@verge.net.au> Date: 2012-08-30 01:12:22
On Wed, Aug 29, 2012 at 06:49:11PM +0200, Julia Lawall wrote:
quoted hunk
From: Julia Lawall <redacted>
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 <redacted>
---
net/netfilter/ipvs/ip_vs_ctl.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
@@ -1171,8 +1171,10 @@ ip_vs_add_service(struct net *net, struct ip_vs_service_user_kern *u,gotoout_err;}svc->stats.cpustats=alloc_percpu(structip_vs_cpu_stats);-if(!svc->stats.cpustats)+if(!svc->stats.cpustats){+ret=-ENOMEM;gotoout_err;+}/* I'm the first user of the service */atomic_set(&svc->usecnt,0);
From: Pablo Neira Ayuso <pablo@netfilter.org> Date: 2012-08-30 01:35:54
On Wed, Aug 29, 2012 at 06:49:11PM +0200, Julia Lawall wrote:
From: Julia Lawall <redacted>
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>