diff options
author | Julia Lawall <Julia.Lawall@lip6.fr> | 2012-08-29 08:49:15 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-08-31 22:27:48 +0200 |
commit | 599901c3e4204e9d9c5a24df5402cd91617a2a26 (patch) | |
tree | 52612fcb3d56add7bfc4c257bbedbe25e587a477 /net/xfrm/xfrm_state.c | |
parent | net: ipv6: fix error return code (diff) | |
download | linux-599901c3e4204e9d9c5a24df5402cd91617a2a26.tar.xz linux-599901c3e4204e9d9c5a24df5402cd91617a2a26.zip |
net/xfrm/xfrm_state.c: fix error return code
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/xfrm/xfrm_state.c')
-rw-r--r-- | net/xfrm/xfrm_state.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c index 87cd0e4d4282..210be48d8ae3 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); |