From owner-svn-src-stable-9@FreeBSD.ORG Mon Feb 27 18:17:03 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D93801065670; Mon, 27 Feb 2012 18:17:03 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C83E18FC08; Mon, 27 Feb 2012 18:17:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1RIH3ro030855; Mon, 27 Feb 2012 18:17:03 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1RIH396030852; Mon, 27 Feb 2012 18:17:03 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201202271817.q1RIH396030852@svn.freebsd.org> From: Jung-uk Kim Date: Mon, 27 Feb 2012 18:17:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232235 - stable/9/sys/dev/fb X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Feb 2012 18:17:04 -0000 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);