mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-25 13:14:07 +08:00
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>
This commit is contained in:
parent
48f125ce1c
commit
599901c3e4
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user