netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/5] xfrm: make aead_len() return unsigned int
@ 2017-09-21 20:45 Alexey Dobriyan
  2017-09-21 20:46 ` [PATCH 2/5] xfrm: make xfrm_alg_len() " Alexey Dobriyan
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Alexey Dobriyan @ 2017-09-21 20:45 UTC (permalink / raw)
  To: steffen.klassert; +Cc: herbert, davem, netdev

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>
---

 include/net/xfrm.h   |    2 +-
 net/xfrm/xfrm_user.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -1764,7 +1764,7 @@ static inline int xfrm_acquire_is_on(struct net *net)
 }
 #endif
 
-static inline int aead_len(struct xfrm_algo_aead *alg)
+static inline unsigned int aead_len(struct xfrm_algo_aead *alg)
 {
 	return sizeof(*alg) + ((alg->alg_key_len + 7) / 8);
 }
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -84,7 +84,7 @@ static int verify_aead(struct nlattr **attrs)
 		return 0;
 
 	algp = nla_data(rt);
-	if (nla_len(rt) < aead_len(algp))
+	if (nla_len(rt) < (int)aead_len(algp))
 		return -EINVAL;
 
 	algp->alg_name[sizeof(algp->alg_name) - 1] = '\0';

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-09-25 11:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-21 20:45 [PATCH 1/5] xfrm: make aead_len() return unsigned int Alexey Dobriyan
2017-09-21 20:46 ` [PATCH 2/5] xfrm: make xfrm_alg_len() " Alexey Dobriyan
2017-09-21 20:47 ` [PATCH 3/5] xfrm: make xfrm_alg_auth_len() " Alexey Dobriyan
2017-09-21 20:47 ` [PATCH 4/5] xfrm: make xfrm_replay_state_esn_len() " Alexey Dobriyan
2017-09-21 20:48 ` [PATCH 5/5] xfrm: eradicate size_t Alexey Dobriyan
2017-09-25 11:46   ` Steffen Klassert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).