]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - net/xfrm/xfrm_policy.c
xfrm: policy: xfrm_get_tos cannot fail
[mirror_ubuntu-artful-kernel.git] / net / xfrm / xfrm_policy.c
index 99ad1af2927f8fc9e27726ec905d60245a004108..6fffa2fac60772c705830669c706179030b64f50 100644 (file)
@@ -1538,19 +1538,13 @@ xfrm_tmpl_resolve(struct xfrm_policy **pols, int npols, const struct flowi *fl,
 
 }
 
-/* Check that the bundle accepts the flow and its components are
- * still valid.
- */
-
-static inline int xfrm_get_tos(const struct flowi *fl, int family)
+static int xfrm_get_tos(const struct flowi *fl, int family)
 {
-       struct xfrm_policy_afinfo *afinfo = xfrm_policy_get_afinfo(family);
-       int tos;
-
-       if (!afinfo)
-               return -EINVAL;
+       struct xfrm_policy_afinfo *afinfo;
+       int tos = 0;
 
-       tos = afinfo->get_tos(fl);
+       afinfo = xfrm_policy_get_afinfo(family);
+       tos = afinfo ? afinfo->get_tos(fl) : 0;
 
        xfrm_policy_put_afinfo(afinfo);
 
@@ -1705,9 +1699,6 @@ static struct dst_entry *xfrm_bundle_create(struct xfrm_policy *policy,
        xfrm_flowi_addr_get(fl, &saddr, &daddr, family);
 
        tos = xfrm_get_tos(fl, family);
-       err = tos;
-       if (tos < 0)
-               goto put_states;
 
        dst_hold(dst);