]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
xfrm: make xfrm_alg_len() return unsigned int
authorAlexey Dobriyan <adobriyan@gmail.com>
Thu, 21 Sep 2017 20:46:30 +0000 (23:46 +0300)
committerSteffen Klassert <steffen.klassert@secunet.com>
Mon, 25 Sep 2017 05:14:06 +0000 (07:14 +0200)
Key lengths can't be negative.

Comparison with nla_len() is left signed just in case negative value
can sneak in there.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
include/net/xfrm.h
net/xfrm/xfrm_user.c

index 0be4c547e383ef4247583aa44fc9213b94239241..2abc0e117f11f44450fb924e309bb4e1b868de17 100644 (file)
@@ -1769,7 +1769,7 @@ static inline unsigned int aead_len(struct xfrm_algo_aead *alg)
        return sizeof(*alg) + ((alg->alg_key_len + 7) / 8);
 }
 
-static inline int xfrm_alg_len(const struct xfrm_algo *alg)
+static inline unsigned int xfrm_alg_len(const struct xfrm_algo *alg)
 {
        return sizeof(*alg) + ((alg->alg_key_len + 7) / 8);
 }
index 32c67b80c3ce895a074e287259afd2c67966bea9..09512d90e6a547bee0cfbe9a5f2433d01e8752d7 100644 (file)
@@ -42,7 +42,7 @@ static int verify_one_alg(struct nlattr **attrs, enum xfrm_attr_type_t type)
                return 0;
 
        algp = nla_data(rt);
-       if (nla_len(rt) < xfrm_alg_len(algp))
+       if (nla_len(rt) < (int)xfrm_alg_len(algp))
                return -EINVAL;
 
        switch (type) {