Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 06cd22f8 authored by Alexey Dobriyan's avatar Alexey Dobriyan Committed by Steffen Klassert
Browse files

xfrm: make xfrm_alg_len() return unsigned int



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: default avatarAlexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: default avatarSteffen Klassert <steffen.klassert@secunet.com>
parent 373b8eeb
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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);
}
+1 −1
Original line number Diff line number Diff line
@@ -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) {