Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern Cast argument to uint64_t first before shifting to ...
details: https://anonhg.NetBSD.org/src/rev/b077b96e0acf
branches: trunk
changeset: 341813:b077b96e0acf
user: joerg <joerg%NetBSD.org@localhost>
date: Mon Nov 23 23:45:44 2015 +0000
description:
Cast argument to uint64_t first before shifting to avoid UB for
left-shifting negative values.
diffstat:
sys/kern/kern_ntptime.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diffs (27 lines):
diff -r fddfe423f283 -r b077b96e0acf sys/kern/kern_ntptime.c
--- a/sys/kern/kern_ntptime.c Mon Nov 23 23:28:33 2015 +0000
+++ b/sys/kern/kern_ntptime.c Mon Nov 23 23:45:44 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_ntptime.c,v 1.56 2015/07/24 13:02:52 maxv Exp $ */
+/* $NetBSD: kern_ntptime.c,v 1.57 2015/11/23 23:45:44 joerg Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
#include <sys/cdefs.h>
/* __FBSDID("$FreeBSD: src/sys/kern/kern_ntptime.c,v 1.59 2005/05/28 14:34:41 rwatson Exp $"); */
-__KERNEL_RCSID(0, "$NetBSD: kern_ntptime.c,v 1.56 2015/07/24 13:02:52 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_ntptime.c,v 1.57 2015/11/23 23:45:44 joerg Exp $");
#ifdef _KERNEL_OPT
#include "opt_ntp.h"
@@ -99,7 +99,7 @@
#define L_MPY(v, a) ((v) *= (a))
#define L_CLR(v) ((v) = 0)
#define L_ISNEG(v) ((v) < 0)
-#define L_LINT(v, a) ((v) = (int64_t)(a) << 32)
+#define L_LINT(v, a) ((v) = (int64_t)((uint64_t)(a) << 32))
#define L_GINT(v) ((v) < 0 ? -(-(v) >> 32) : (v) >> 32)
#ifdef NTP
Home |
Main Index |
Thread Index |
Old Index