Source-Changes-HG archive

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

[src/trunk]: src/sys/external/bsd/drm2/include/linux Clamp timeout to INT_MAX...



details:   https://anonhg.NetBSD.org/src/rev/32b35b0b3e8a
branches:  trunk
changeset: 445329:32b35b0b3e8a
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Tue Oct 23 03:56:47 2018 +0000

description:
Clamp timeout to INT_MAX to avoid the bad kind of integer truncation.

XXX pullup-7
XXX pullup-8

diffstat:

 sys/external/bsd/drm2/include/linux/sched.h |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (20 lines):

diff -r f3c348557ca6 -r 32b35b0b3e8a sys/external/bsd/drm2/include/linux/sched.h
--- a/sys/external/bsd/drm2/include/linux/sched.h       Tue Oct 23 03:56:33 2018 +0000
+++ b/sys/external/bsd/drm2/include/linux/sched.h       Tue Oct 23 03:56:47 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sched.h,v 1.11 2018/10/23 03:56:33 riastradh Exp $     */
+/*     $NetBSD: sched.h,v 1.12 2018/10/23 03:56:47 riastradh Exp $     */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -74,8 +74,8 @@
        }
 
        start = hardclock_ticks;
-       /* XXX Integer truncation...not likely to matter here.  */
-       (void)kpause("loonix", false /*!intr*/, timeout, NULL);
+       /* Caller is expected to loop anyway, so no harm in truncating.  */
+       (void)kpause("loonix", false /*!intr*/, MIN(timeout, INT_MAX), NULL);
        end = hardclock_ticks;
 
        remain = timeout - (end - start);



Home | Main Index | Thread Index | Old Index