[coreboot] libpayload: video/vga driver checks unsigned variables for negative values

Jordan Crouse jordan.crouse at amd.com
Thu Sep 11 19:42:22 CEST 2008


On 11/09/08 19:28 +0200, Patrick Georgi wrote:
> Hi,
> 
> attached patch makes cursorx and cursory signed, as there are several
> "if (cursorx < 0)" tests.
> I also added another one, to make backspace wrap backwards into the
> previous line, if necessary.
> 

Acked-by: Jordan Crouse <jordan.crouse at amd.com>

> Patrick Georgi

> === drivers/video/video.c
> ==================================================================
> --- drivers/video/video.c	(revision 1708)
> +++ drivers/video/video.c	(local)
> @@ -51,8 +51,8 @@
>  
>  static struct video_console *console;
>  
> -static unsigned int cursorx;
> -static unsigned int cursory;
> +static int cursorx;
> +static int cursory;
>  static unsigned int cursor_enabled = 1;
>  
>  static void video_console_fixup_cursor(void)
> @@ -122,6 +122,10 @@
>  
>  	case '\b':
>  		cursorx--;
> +		if (cursorx < 0) {
> +			cursory--;
> +			cursorx = VIDEO_COLS;
> +		}
>  		break;
>  
>  	case '\t':
> @@ -172,7 +176,7 @@
>  			console = console_list[i];
>  
>  			if (console->get_cursor)
> -				console->get_cursor(&cursorx, &cursory, &cursor_enabled);
> +				console->get_cursor((unsigned int*)&cursorx, (unsigned int*)&cursory, &cursor_enabled);
>  
>  			if (cursorx) {
>  				cursorx = 0;

> --
> coreboot mailing list: coreboot at coreboot.org
> http://www.coreboot.org/mailman/listinfo/coreboot


-- 
Jordan Crouse
Systems Software Development Engineer 
Advanced Micro Devices, Inc.





More information about the coreboot mailing list