svn commit: r282730 - head/sys/dev/vt

Hans Petter Selasky hselasky at FreeBSD.org
Sun May 10 17:11:05 UTC 2015


Author: hselasky
Date: Sun May 10 17:11:04 2015
New Revision: 282730
URL: https://svnweb.freebsd.org/changeset/base/282730

Log:
  Ensure the result from signed subtraction under modulus does not
  become negative.
  
  Submitted by:		Oliver Pinter <oliver.pinter at hardenedbsd.org>
  MFC after:		3 days

Modified:
  head/sys/dev/vt/vt_core.c

Modified: head/sys/dev/vt/vt_core.c
==============================================================================
--- head/sys/dev/vt/vt_core.c	Sun May 10 14:50:50 2015	(r282729)
+++ head/sys/dev/vt/vt_core.c	Sun May 10 17:11:04 2015	(r282730)
@@ -785,7 +785,7 @@ vt_processkey(keyboard_t *kbd, struct vt
 			return (0);
 		case PREV:
 			/* Switch to previous VT. */
-			c = (vw->vw_number - 1) % VT_MAXWINDOWS;
+			c = (vw->vw_number + VT_MAXWINDOWS - 1) % VT_MAXWINDOWS;
 			vw = vd->vd_windows[c];
 			vt_proc_window_switch(vw);
 			return (0);


More information about the svn-src-head mailing list