svn commit: r275898 - stable/10/sys/kern

Konstantin Belousov kib at FreeBSD.org
Thu Dec 18 11:10:16 UTC 2014


Author: kib
Date: Thu Dec 18 11:10:15 2014
New Revision: 275898
URL: https://svnweb.freebsd.org/changeset/base/275898

Log:
  MFC r259609 (by se):
  Fix overflow for timeout values of more than 68 years, which is the maximum
  covered by sbintime (LONG_MAX seconds).
  
  MFC r259633 (by se):
  Fix compilation on 32 bit architectures and use INT64_MAX instead of
  LONG_MAX for the upper bound check.

Modified:
  stable/10/sys/kern/kern_event.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/kern/kern_event.c
==============================================================================
--- stable/10/sys/kern/kern_event.c	Thu Dec 18 10:01:12 2014	(r275897)
+++ stable/10/sys/kern/kern_event.c	Thu Dec 18 11:10:15 2014	(r275898)
@@ -522,10 +522,14 @@ knote_fork(struct knlist *list, int pid)
  * XXX: EVFILT_TIMER should perhaps live in kern_time.c beside the
  * interval timer support code.
  */
-static __inline sbintime_t 
+static __inline sbintime_t
 timer2sbintime(intptr_t data)
 {
 
+#ifdef __LP64__
+	if (data > INT64_MAX / SBT_1MS)
+		return INT64_MAX;
+#endif
 	return (SBT_1MS * data);
 }
 


More information about the svn-src-all mailing list