NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/54767: Wrong mask constant in VESA BIOS Extensions code



>Number:         54767
>Category:       kern
>Synopsis:       Wrong mask constant in VESA BIOS Extensions code
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Dec 14 21:45:00 +0000 2019
>Originator:     elo
>Release:        NetBSD 9.0_BETA
>Organization:
>Environment:
System: NetBSD marmite.localnet 9.0_BETA NetBSD 9.0_BETA (BLUEBELL) #3: Sun Nov 3 02:10:56 GMT 2019 elo@marmite.localnet:/usr/obj/sys/arch/amd64/compile/BLUEBELL amd64
Architecture: x86_64
Machine: amd64
>Description:
	In the file 'src/sys/arch/i386/stand/lib/vbe.c' is a mask
	constant with transposed digits. According to the 'VESA BIOS
	EXTENSION (VBE) Core Functions Standard, Version 3.0', dated
	16 September 1998, found at
	http://www.petesqbsite.com/sections/tutorials/tuts/vbe3.pdf,
	in the ModeAttributes field of the ModeInfoBlock structure for
	VBE Function 01h (see page 32), it is bit 7 that indicates
	whether linear frame-buffer mode is available, but because
	the mask is wrong (0x08 instead of 0x80), it is in fact the
	graphics/text-mode flag being tested.
>How-To-Repeat:
	The error was found by code inspection. To my knowledge, it
	has never caused a problem in practice.
>Fix:
	Apply the following patch.

--- a/usr/src/sys/arch/i386/stand/lib/vbe.c	2019-08-21 04:14:10.759601198 +0100
+++ b/usr/src/sys/arch/i386/stand/lib/vbe.c	2019-08-21 04:14:10.800315268 +0100
@@ -50,7 +50,7 @@
 {
 	if ((mi->ModeAttributes & 0x01) == 0)
 		return 0;	/* mode not supported by hardware */
-	if ((mi->ModeAttributes & 0x08) == 0)
+	if ((mi->ModeAttributes & 0x80) == 0)
 		return 0;	/* linear fb not available */
 	if ((mi->ModeAttributes & 0x10) == 0)
 		return 0;	/* text mode */



Home | Main Index | Thread Index | Old Index