PR kern/51371: avoid shifting negative values

This commit is contained in:
martin 2016-07-28 07:54:31 +00:00
parent 07832dcc0c
commit 1982ce327f
2 changed files with 7 additions and 7 deletions

View File

@ -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 @@ rt_xaddrs(u_char rtmtype, const char *cp, const char *cplim,
*/
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) {

View File

@ -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 @@ vtw_next_port_v4(struct tcp_ports_iterator *it)
if (!(inuse & (1 << i)))
continue;
inuse &= ~0 << i;
inuse &= ~0U << i;
if (i < it->slot_idx)
continue;
@ -1164,7 +1164,7 @@ vtw_next_port_v6(struct tcp_ports_iterator *it)
if (!(inuse & (1 << i)))
continue;
inuse &= ~0 << i;
inuse &= ~0U << i;
if (i < it->slot_idx)
continue;