aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/ipv4/tcp_output.c6
-rw-r--r--net/key/af_key.c17
2 files changed, 6 insertions, 17 deletions
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index a61a3e3082ae..d65d17bb2a09 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -646,11 +646,7 @@ static void tcp_set_skb_tso_segs(struct sock *sk, struct sk_buff *skb, unsigned
646 skb_shinfo(skb)->gso_size = 0; 646 skb_shinfo(skb)->gso_size = 0;
647 skb_shinfo(skb)->gso_type = 0; 647 skb_shinfo(skb)->gso_type = 0;
648 } else { 648 } else {
649 unsigned int factor; 649 skb_shinfo(skb)->gso_segs = DIV_ROUND_UP(skb->len, mss_now);
650
651 factor = skb->len + (mss_now - 1);
652 factor /= mss_now;
653 skb_shinfo(skb)->gso_segs = factor;
654 skb_shinfo(skb)->gso_size = mss_now; 650 skb_shinfo(skb)->gso_size = mss_now;
655 skb_shinfo(skb)->gso_type = sk->sk_gso_type; 651 skb_shinfo(skb)->gso_type = sk->sk_gso_type;
656 } 652 }
diff --git a/net/key/af_key.c b/net/key/af_key.c
index 5502df115a63..17b2a6927f01 100644
--- a/net/key/af_key.c
+++ b/net/key/af_key.c
@@ -352,16 +352,14 @@ static int verify_address_len(void *p)
352 352
353 switch (addr->sa_family) { 353 switch (addr->sa_family) {
354 case AF_INET: 354 case AF_INET:
355 len = sizeof(*sp) + sizeof(*sin) + (sizeof(uint64_t) - 1); 355 len = DIV_ROUND_UP(sizeof(*sp) + sizeof(*sin), sizeof(uint64_t));
356 len /= sizeof(uint64_t);
357 if (sp->sadb_address_len != len || 356 if (sp->sadb_address_len != len ||
358 sp->sadb_address_prefixlen > 32) 357 sp->sadb_address_prefixlen > 32)
359 return -EINVAL; 358 return -EINVAL;
360 break; 359 break;
361#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 360#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
362 case AF_INET6: 361 case AF_INET6:
363 len = sizeof(*sp) + sizeof(*sin6) + (sizeof(uint64_t) - 1); 362 len = DIV_ROUND_UP(sizeof(*sp) + sizeof(*sin6), sizeof(uint64_t));
364 len /= sizeof(uint64_t);
365 if (sp->sadb_address_len != len || 363 if (sp->sadb_address_len != len ||
366 sp->sadb_address_prefixlen > 128) 364 sp->sadb_address_prefixlen > 128)
367 return -EINVAL; 365 return -EINVAL;
@@ -386,14 +384,9 @@ static int verify_address_len(void *p)
386 384
387static inline int pfkey_sec_ctx_len(struct sadb_x_sec_ctx *sec_ctx) 385static inline int pfkey_sec_ctx_len(struct sadb_x_sec_ctx *sec_ctx)
388{ 386{
389 int len = 0; 387 return DIV_ROUND_UP(sizeof(struct sadb_x_sec_ctx) +
390 388 sec_ctx->sadb_x_ctx_len,
391 len += sizeof(struct sadb_x_sec_ctx); 389 sizeof(uint64_t));
392 len += sec_ctx->sadb_x_ctx_len;
393 len += sizeof(uint64_t) - 1;
394 len /= sizeof(uint64_t);
395
396 return len;
397} 390}
398 391
399static inline int verify_sec_ctx_len(void *p) 392static inline int verify_sec_ctx_len(void *p)