Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 27 Feb 2012 18:17:03 +0000 (UTC)
From:      Jung-uk Kim <jkim@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r232235 - stable/9/sys/dev/fb
Message-ID:  <201202271817.q1RIH396030852@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jkim
Date: Mon Feb 27 18:17:03 2012
New Revision: 232235
URL: http://svn.freebsd.org/changeset/base/232235

Log:
  MFC:	r231841, r231842
  
  Properly check VESA video mode number.

Modified:
  stable/9/sys/dev/fb/vesa.c
  stable/9/sys/dev/fb/vesa.h
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/dev/fb/vesa.c
==============================================================================
--- stable/9/sys/dev/fb/vesa.c	Mon Feb 27 17:41:23 2012	(r232234)
+++ stable/9/sys/dev/fb/vesa.c	Mon Feb 27 18:17:03 2012	(r232235)
@@ -1311,7 +1311,9 @@ vesa_set_mode(video_adapter_t *adp, int 
 	if (!(info.vi_flags & V_INFO_GRAPHICS))
 		info.vi_flags &= ~V_INFO_LINEAR;
 
-	if (vesa_bios_set_mode(mode | ((info.vi_flags & V_INFO_LINEAR) ? 0x4000 : 0)))
+	if ((info.vi_flags & V_INFO_LINEAR) != 0)
+		mode |= 0x4000;
+	if (vesa_bios_set_mode(mode))
 		return (1);
 
 	/* Palette format is reset by the above VBE function call. */
@@ -1329,7 +1331,7 @@ vesa_set_mode(video_adapter_t *adp, int 
 #if VESA_DEBUG > 0
 	printf("VESA: mode set!\n");
 #endif
-	vesa_adp->va_mode = mode;
+	vesa_adp->va_mode = mode & 0x1ff;	/* Mode number is 9-bit. */
 	vesa_adp->va_flags &= ~V_ADP_COLOR;
 	vesa_adp->va_flags |= 
 		(info.vi_flags & V_INFO_COLOR) ? V_ADP_COLOR : 0;

Modified: stable/9/sys/dev/fb/vesa.h
==============================================================================
--- stable/9/sys/dev/fb/vesa.h	Mon Feb 27 17:41:23 2012	(r232234)
+++ stable/9/sys/dev/fb/vesa.h	Mon Feb 27 18:17:03 2012	(r232235)
@@ -126,7 +126,7 @@ struct vesa_mode 
 
 #ifdef _KERNEL
 
-#define VESA_MODE(x)	((x) >= M_VESA_BASE)
+#define VESA_MODE(x)	((x) >= M_VESA_BASE && (x) <= M_VESA_MODE_MAX)
 
 int vesa_load_ioctl(void);
 int vesa_unload_ioctl(void);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201202271817.q1RIH396030852>