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);
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to