Source-Changes-HG archive

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

[src/trunk]: src/sys PR kern/51371: avoid shifting negative values



details:   https://anonhg.NetBSD.org/src/rev/400e9c5bf448
branches:  trunk
changeset: 346688:400e9c5bf448
user:      martin <martin%NetBSD.org@localhost>
date:      Thu Jul 28 07:54:31 2016 +0000

description:
PR kern/51371: avoid shifting negative values

diffstat:

 sys/net/rtsock.c      |  8 ++++----
 sys/netinet/tcp_vtw.c |  6 +++---
 2 files changed, 7 insertions(+), 7 deletions(-)

diffs (60 lines):

diff -r fa4ca58b8b38 -r 400e9c5bf448 sys/net/rtsock.c
--- a/sys/net/rtsock.c  Thu Jul 28 07:52:06 2016 +0000
+++ b/sys/net/rtsock.c  Thu Jul 28 07:54:31 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rtsock.c,v 1.192 2016/07/21 03:45:56 ozaki-r Exp $     */
+/*     $NetBSD: rtsock.c,v 1.193 2016/07/28 07:54:31 martin Exp $      */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.192 2016/07/21 03:45:56 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.193 2016/07/28 07:54:31 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -971,9 +971,9 @@
         */
        if (rtmtype == RTM_GET) {
                if (((rtinfo->rti_addrs &
-                   (~((1 << RTAX_IFP) | (1 << RTAX_IFA)))) & (~0 << i)) != 0)
+                   (~((1 << RTAX_IFP) | (1 << RTAX_IFA)))) & (~0U << i)) != 0)
                        return 1;
-       } else if ((rtinfo->rti_addrs & (~0 << i)) != 0)
+       } else if ((rtinfo->rti_addrs & (~0U << i)) != 0)
                return 1;
        /* Check for bad data length.  */
        if (cp != cplim) {
diff -r fa4ca58b8b38 -r 400e9c5bf448 sys/netinet/tcp_vtw.c
--- a/sys/netinet/tcp_vtw.c     Thu Jul 28 07:52:06 2016 +0000
+++ b/sys/netinet/tcp_vtw.c     Thu Jul 28 07:54:31 2016 +0000
@@ -123,7 +123,7 @@
 
 #include <netinet/tcp_vtw.h>
 
-__KERNEL_RCSID(0, "$NetBSD: tcp_vtw.c,v 1.15 2016/04/26 08:44:45 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_vtw.c,v 1.16 2016/07/28 07:54:31 martin Exp $");
 
 #define db_trace(__a, __b)     do { } while (/*CONSTCOND*/0)
 
@@ -1050,7 +1050,7 @@
                        if (!(inuse & (1 << i)))
                                continue;
 
-                       inuse &= ~0 << i;
+                       inuse &= ~0U << i;
 
                        if (i < it->slot_idx)
                                continue;
@@ -1164,7 +1164,7 @@
                        if (!(inuse & (1 << i)))
                                continue;
 
-                       inuse &= ~0 << i;
+                       inuse &= ~0U << i;
 
                        if (i < it->slot_idx)
                                continue;



Home | Main Index | Thread Index | Old Index