linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/7] fix error return code
@ 2012-08-29 16:49 Julia Lawall
  2012-08-29 16:49 ` [PATCH 1/7] ipvs: " Julia Lawall
                   ` (6 more replies)
  0 siblings, 7 replies; 15+ messages in thread
From: Julia Lawall @ 2012-08-29 16:49 UTC (permalink / raw)
  To: linux-kernel; +Cc: kernel-janitors

These patches fix cases where the return code appears to be unintentially
nonnegative.

The complete semantic match that finds the problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@ok exists@
identifier f,ret,i;
expression e;
constant c;
@@

f(...) {
<+...
(
return -c@i;
|
ret = -c@i;
... when != ret = e
return ret;
|
if (ret < 0) { ... return ret; }
)
...+> }

@r exists@
identifier ret,l,ok.f;
expression e1,e2,e3;
statement S;
position p1,p2,p3;
@@

f(...) {
... when any
(
if@p1 (\(ret < 0\|ret != 0\))
 { ... return ret; }
|
ret@p1 = 0
)
... when != ret = e1
    when != &ret
(
 if (<+... ret = e3 ...+>) S
|
 if (<+... &ret ...+>) S
|
if@p2(...)
 {
  ... when != ret = e2
      when forall
 return@p3 ret;
}
)
... when any
}

@bad exists@
position r.p1,r.p2;
statement S1,S2;
identifier r.ret;
expression e1;
@@

(
if@p1 (\(ret < 0\|ret != 0\)) S1
|
ret@p1 = 0
)
... when any
ret = e1
... when any
if@p2(...) S2

@bad2@
position r.p1,r.p2;
identifier r.ret;
expression e1;
statement S2;
@@

ret@p1 = 0
... when != if (...) { ... ret = e1 ... return ret; }
    when any
if@p2(...) S2


@script:python depends on !bad && !bad2@
p1 << r.p1;
p2 << r.p2;
p3 << r.p3;
@@

cocci.print_main("",p1)
cocci.print_secs("",p2)
cocci.print_secs("",p3)
// </smpl>


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 1/7] ipvs: fix error return code
  2012-08-29 16:49 [PATCH 0/7] fix error return code Julia Lawall
@ 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 2/7] net: ipv6: " Julia Lawall
                   ` (5 subsequent siblings)
  6 siblings, 2 replies; 15+ 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] 15+ messages in thread

* [PATCH 2/7] net: ipv6: fix error return code
  2012-08-29 16:49 [PATCH 0/7] fix error return code Julia Lawall
  2012-08-29 16:49 ` [PATCH 1/7] ipvs: " Julia Lawall
@ 2012-08-29 16:49 ` Julia Lawall
  2012-08-31 20:28   ` David Miller
  2012-08-29 16:49 ` [PATCH 3/7] logfs: " Julia Lawall
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 15+ messages in thread
From: Julia Lawall @ 2012-08-29 16:49 UTC (permalink / raw)
  To: David S. Miller
  Cc: kernel-janitors, Alexey Kuznetsov, James Morris,
	Hideaki YOSHIFUJI, Patrick McHardy, netdev, linux-kernel

From: Julia Lawall <Julia.Lawall@lip6.fr>

Initialize return variable before exiting on an error path.

The initial initialization of the return variable is also dropped, because
that value is never used.

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/ipv6/esp6.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c
index 6dc7fd3..282f372 100644
--- a/net/ipv6/esp6.c
+++ b/net/ipv6/esp6.c
@@ -167,8 +167,6 @@ static int esp6_output(struct xfrm_state *x, struct sk_buff *skb)
 	struct esp_data *esp = x->data;
 
 	/* skb is pure payload to encrypt */
-	err = -ENOMEM;
-
 	aead = esp->aead;
 	alen = crypto_aead_authsize(aead);
 
@@ -203,8 +201,10 @@ static int esp6_output(struct xfrm_state *x, struct sk_buff *skb)
 	}
 
 	tmp = esp_alloc_tmp(aead, nfrags + sglists, seqhilen);
-	if (!tmp)
+	if (!tmp) {
+		err = -ENOMEM;
 		goto error;
+	}
 
 	seqhi = esp_tmp_seqhi(tmp);
 	iv = esp_tmp_iv(aead, tmp, seqhilen);


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 3/7] logfs: fix error return code
  2012-08-29 16:49 [PATCH 0/7] fix error return code Julia Lawall
  2012-08-29 16:49 ` [PATCH 1/7] ipvs: " Julia Lawall
  2012-08-29 16:49 ` [PATCH 2/7] net: ipv6: " Julia Lawall
@ 2012-08-29 16:49 ` Julia Lawall
  2012-08-29 16:49 ` [PATCH 4/7] net/bluetooth/rfcomm/core.c: " Julia Lawall
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 15+ messages in thread
From: Julia Lawall @ 2012-08-29 16:49 UTC (permalink / raw)
  To: Joern Engel; +Cc: kernel-janitors, Prasad Joshi, logfs, 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>

---
 fs/logfs/segment.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/logfs/segment.c b/fs/logfs/segment.c
index 038da09..0cf91e4 100644
--- a/fs/logfs/segment.c
+++ b/fs/logfs/segment.c
@@ -601,6 +601,7 @@ static int __logfs_segment_read(struct inode *inode, void *buf,
 					"%llx: expected %x, got %x\n", ofs,
 					be32_to_cpu(oh.data_crc),
 					be32_to_cpu(crc));
+			err = -EIO;
 			goto out_err;
 		}
 		break;
@@ -619,6 +620,7 @@ static int __logfs_segment_read(struct inode *inode, void *buf,
 					be32_to_cpu(oh.data_crc),
 					be32_to_cpu(crc));
 			mutex_unlock(&logfs_super(sb)->s_journal_mutex);
+			err = -EIO;
 			goto out_err;
 		}
 		err = logfs_uncompress(compressor_buf, buf, len, block_len);


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 4/7] net/bluetooth/rfcomm/core.c: fix error return code
  2012-08-29 16:49 [PATCH 0/7] fix error return code Julia Lawall
                   ` (2 preceding siblings ...)
  2012-08-29 16:49 ` [PATCH 3/7] logfs: " Julia Lawall
@ 2012-08-29 16:49 ` Julia Lawall
  2012-08-29 18:23   ` Marcel Holtmann
  2012-08-29 16:49 ` [PATCH 5/7] net/xfrm/xfrm_state.c: " Julia Lawall
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 15+ messages in thread
From: Julia Lawall @ 2012-08-29 16:49 UTC (permalink / raw)
  To: Marcel Holtmann
  Cc: kernel-janitors, Gustavo Padovan, Johan Hedberg, David S. Miller,
	linux-bluetooth, 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/bluetooth/rfcomm/core.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c
index c75107e..30141c0 100644
--- a/net/bluetooth/rfcomm/core.c
+++ b/net/bluetooth/rfcomm/core.c
@@ -2010,8 +2010,10 @@ static int rfcomm_add_listener(bdaddr_t *ba)
 
 	/* Add listening session */
 	s = rfcomm_session_add(sock, BT_LISTEN);
-	if (!s)
+	if (!s) {
+		err = -ENOMEM;
 		goto failed;
+	}
 
 	rfcomm_session_hold(s);
 	return 0;


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 5/7] net/xfrm/xfrm_state.c: fix error return code
  2012-08-29 16:49 [PATCH 0/7] fix error return code Julia Lawall
                   ` (3 preceding siblings ...)
  2012-08-29 16:49 ` [PATCH 4/7] net/bluetooth/rfcomm/core.c: " Julia Lawall
@ 2012-08-29 16:49 ` Julia Lawall
  2012-08-31 20:28   ` David Miller
  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
  6 siblings, 1 reply; 15+ messages in thread
From: Julia Lawall @ 2012-08-29 16:49 UTC (permalink / raw)
  To: David S. Miller; +Cc: kernel-janitors, 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/xfrm/xfrm_state.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
index 7856c33..b68e0cc 100644
--- a/net/xfrm/xfrm_state.c
+++ b/net/xfrm/xfrm_state.c
@@ -1994,8 +1994,10 @@ int __xfrm_init_state(struct xfrm_state *x, bool init_replay)
 		goto error;
 
 	x->outer_mode = xfrm_get_mode(x->props.mode, family);
-	if (x->outer_mode == NULL)
+	if (x->outer_mode == NULL) {
+		err = -EPROTONOSUPPORT;
 		goto error;
+	}
 
 	if (init_replay) {
 		err = xfrm_init_replay(x);


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 7/7] net/netfilter/nf_conntrack_netlink.c: fix error return code
  2012-08-29 16:49 [PATCH 0/7] fix error return code Julia Lawall
                   ` (4 preceding siblings ...)
  2012-08-29 16:49 ` [PATCH 5/7] net/xfrm/xfrm_state.c: " 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
  6 siblings, 1 reply; 15+ 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] 15+ messages in thread

* [PATCH 6/7] net/netfilter/nfnetlink_log.c: fix error return code
  2012-08-29 16:49 [PATCH 0/7] fix error return code Julia Lawall
                   ` (5 preceding siblings ...)
  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
  6 siblings, 1 reply; 15+ 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] 15+ messages in thread

* Re: [PATCH 4/7] net/bluetooth/rfcomm/core.c: fix error return code
  2012-08-29 16:49 ` [PATCH 4/7] net/bluetooth/rfcomm/core.c: " Julia Lawall
@ 2012-08-29 18:23   ` Marcel Holtmann
  0 siblings, 0 replies; 15+ messages in thread
From: Marcel Holtmann @ 2012-08-29 18:23 UTC (permalink / raw)
  To: Julia Lawall
  Cc: kernel-janitors, Gustavo Padovan, Johan Hedberg, David S. Miller,
	linux-bluetooth, netdev, linux-kernel

Hi Julia,

> 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/bluetooth/rfcomm/core.c |    4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

Acked-by: Marcel Holtmann <marcel@holtmann.org>

Regards

Marcel



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 1/7] ipvs: fix error return code
  2012-08-29 16:49 ` [PATCH 1/7] ipvs: " Julia Lawall
@ 2012-08-30  1:12   ` Simon Horman
  2012-08-30  1:34   ` Pablo Neira Ayuso
  1 sibling, 0 replies; 15+ 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] 15+ messages in thread

* Re: [PATCH 1/7] ipvs: fix error return code
  2012-08-29 16:49 ` [PATCH 1/7] ipvs: " Julia Lawall
  2012-08-30  1:12   ` Simon Horman
@ 2012-08-30  1:34   ` Pablo Neira Ayuso
  1 sibling, 0 replies; 15+ 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] 15+ 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; 15+ 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] 15+ 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; 15+ 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] 15+ messages in thread

* Re: [PATCH 2/7] net: ipv6: fix error return code
  2012-08-29 16:49 ` [PATCH 2/7] net: ipv6: " Julia Lawall
@ 2012-08-31 20:28   ` David Miller
  0 siblings, 0 replies; 15+ messages in thread
From: David Miller @ 2012-08-31 20:28 UTC (permalink / raw)
  To: Julia.Lawall
  Cc: kernel-janitors, kuznet, jmorris, yoshfuji, kaber, netdev, linux-kernel

From: Julia Lawall <Julia.Lawall@lip6.fr>
Date: Wed, 29 Aug 2012 18:49:12 +0200

> From: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> Initialize return variable before exiting on an error path.
> 
> The initial initialization of the return variable is also dropped, because
> that value is never used.
> 
> A simplified version of the semantic match that finds this problem is as
> follows: (http://coccinelle.lip6.fr/)
 ...
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

Applied.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 5/7] net/xfrm/xfrm_state.c: fix error return code
  2012-08-29 16:49 ` [PATCH 5/7] net/xfrm/xfrm_state.c: " Julia Lawall
@ 2012-08-31 20:28   ` David Miller
  0 siblings, 0 replies; 15+ messages in thread
From: David Miller @ 2012-08-31 20:28 UTC (permalink / raw)
  To: Julia.Lawall; +Cc: kernel-janitors, netdev, linux-kernel

From: Julia Lawall <Julia.Lawall@lip6.fr>
Date: Wed, 29 Aug 2012 18:49:15 +0200

> 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/)
 ...
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

Applied.

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2012-08-31 20:28 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-29 16:49 [PATCH 0/7] fix error return code Julia Lawall
2012-08-29 16:49 ` [PATCH 1/7] ipvs: " Julia Lawall
2012-08-30  1:12   ` Simon Horman
2012-08-30  1:34   ` Pablo Neira Ayuso
2012-08-29 16:49 ` [PATCH 2/7] net: ipv6: " Julia Lawall
2012-08-31 20:28   ` David Miller
2012-08-29 16:49 ` [PATCH 3/7] logfs: " Julia Lawall
2012-08-29 16:49 ` [PATCH 4/7] net/bluetooth/rfcomm/core.c: " Julia Lawall
2012-08-29 18:23   ` Marcel Holtmann
2012-08-29 16:49 ` [PATCH 5/7] net/xfrm/xfrm_state.c: " Julia Lawall
2012-08-31 20:28   ` David Miller
2012-08-29 16:49 ` [PATCH 7/7] net/netfilter/nf_conntrack_netlink.c: " 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
2012-08-30  1:35   ` Pablo Neira Ayuso

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).