aboutsummaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorYueHaibing <yuehaibing@huawei.com>2018-07-25 16:54:33 +0800
committerMoyster <oysterized@gmail.com>2019-05-03 19:24:03 +0200
commit770d5ebf73562194e1ab962768756a080722acb2 (patch)
tree7fe0bcc40d1ae401255fb89b4b9f3e999fdffc4c /net
parent35a0fb0e3f622f673ee1794f4072e7ed710e8151 (diff)
xfrm: fix 'passing zero to ERR_PTR()' warning
commit 934ffce1343f22ed5e2d0bd6da4440f4848074de upstream. Fix a static code checker warning: net/xfrm/xfrm_policy.c:1836 xfrm_resolve_and_create_bundle() warn: passing zero to 'ERR_PTR' xfrm_tmpl_resolve return 0 just means no xdst found, return NULL instead of passing zero to ERR_PTR. Fixes: d809ec895505 ("xfrm: do not assume that template resolving always returns xfrms") Change-Id: Ia6fdb9a01f2360ada2ef7abd0972e39f174ebc74 Signed-off-by: YueHaibing <yuehaibing@huawei.com> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Diffstat (limited to 'net')
-rw-r--r--net/xfrm/xfrm_policy.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index 0bd022e55..0740adcba 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -1721,7 +1721,10 @@ xfrm_resolve_and_create_bundle(struct xfrm_policy **pols, int num_pols,
/* Try to instantiate a bundle */
err = xfrm_tmpl_resolve(pols, num_pols, fl, xfrm, family);
if (err <= 0) {
- if (err != 0 && err != -EAGAIN)
+ if (err == 0)
+ return NULL;
+
+ if (err != -EAGAIN)
XFRM_INC_STATS(net, LINUX_MIB_XFRMOUTPOLERROR);
return ERR_PTR(err);
}