Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/netinet No need to update mlen also in the case of (mlen...



details:   https://anonhg.NetBSD.org/src/rev/bcb032fe6813
branches:  trunk
changeset: 364932:bcb032fe6813
user:      rin <rin%NetBSD.org@localhost>
date:      Tue Aug 28 07:28:01 2018 +0000

description:
No need to update mlen also in the case of (mlen & 16) != 0.

diffstat:

 sys/netinet/cpu_in_cksum.c |  13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)

diffs (42 lines):

diff -r cc2114fd3a07 -r bcb032fe6813 sys/netinet/cpu_in_cksum.c
--- a/sys/netinet/cpu_in_cksum.c        Tue Aug 28 03:48:38 2018 +0000
+++ b/sys/netinet/cpu_in_cksum.c        Tue Aug 28 07:28:01 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu_in_cksum.c,v 1.1 2008/01/25 21:12:14 joerg Exp $   */
+/*     $NetBSD: cpu_in_cksum.c,v 1.2 2018/08/28 07:28:01 rin Exp $     */
 /*-
  * Copyright (c) 2008 Joerg Sonnenberger <joerg%NetBSD.org@localhost>.
  * All rights reserved.
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu_in_cksum.c,v 1.1 2008/01/25 21:12:14 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_in_cksum.c,v 1.2 2018/08/28 07:28:01 rin Exp $");
 
 #include <sys/param.h>
 #include <sys/endian.h>
@@ -162,6 +162,10 @@
                                partial = 0;
                        }
                }
+               /*
+                * mlen is not updated below as the remaining tests
+                * are using bit masks, which are not affected.
+                */
                if (mlen & 16) {
                        partial += *(uint16_t *)data;
                        partial += *(uint16_t *)(data + 2);
@@ -172,12 +176,7 @@
                        partial += *(uint16_t *)(data + 12);
                        partial += *(uint16_t *)(data + 14);
                        data += 16;
-                       mlen -= 16;
                }
-               /*
-                * mlen is not updated below as the remaining tests
-                * are using bit masks, which are not affected.
-                */
                if (mlen & 8) {
                        partial += *(uint16_t *)data;
                        partial += *(uint16_t *)(data + 2);



Home | Main Index | Thread Index | Old Index