Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/net Use 1000ULL to prevent integer overflow (for IF_Gbps...
details: https://anonhg.NetBSD.org/src/rev/526eb6212315
branches: trunk
changeset: 337117:526eb6212315
user: msaitoh <msaitoh%NetBSD.org@localhost>
date: Fri Apr 03 08:20:55 2015 +0000
description:
Use 1000ULL to prevent integer overflow (for IF_Gbps(10)). Same as OpenBSD.
diffstat:
sys/net/if.h | 9 ++++-----
1 files changed, 4 insertions(+), 5 deletions(-)
diffs (24 lines):
diff -r f789f3f43e4d -r 526eb6212315 sys/net/if.h
--- a/sys/net/if.h Fri Apr 03 07:56:54 2015 +0000
+++ b/sys/net/if.h Fri Apr 03 08:20:55 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if.h,v 1.185 2015/01/16 10:37:51 ozaki-r Exp $ */
+/* $NetBSD: if.h,v 1.186 2015/04/03 08:20:55 msaitoh Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -396,11 +396,10 @@
/*
* Some convenience macros used for setting ifi_baudrate.
- * XXX 1000 vs. 1024? --thorpej%NetBSD.org@localhost
*/
-#define IF_Kbps(x) ((x) * 1000) /* kilobits/sec. */
-#define IF_Mbps(x) (IF_Kbps((x) * 1000)) /* megabits/sec. */
-#define IF_Gbps(x) (IF_Mbps((x) * 1000)) /* gigabits/sec. */
+#define IF_Kbps(x) ((x) * 1000ULL) /* kilobits/sec. */
+#define IF_Mbps(x) (IF_Kbps((x) * 1000ULL)) /* megabits/sec. */
+#define IF_Gbps(x) (IF_Mbps((x) * 1000ULL)) /* gigabits/sec. */
/* Capabilities that interfaces can advertise. */
/* 0x01 .. 0x40 were previously used */
Home |
Main Index |
Thread Index |
Old Index