Thread (2 messages) 2 messages, 2 authors, 2009-05-11

Re: [PATCH] make viafb work on x86_64

From: Krzysztof Helt <hidden>
Date: 2009-05-11 21:02:48

On Tue, 12 May 2009 00:49:15 +0800
Harald Welte [off-list ref] wrote:
[FB] make viafb work on x86_64

This patch makes fixes a bug in viafb on x86_64 builds (e.g. for VIA Nano CPU).
You cannot make the assumption that sizeof(unsigned int) == sizeof(unsigned
long), so the parsing of the default mode (640x480) fails, leading to a
division by zero during insmod of the driver.

Signed-off-by: Harald Welte <redacted>
Acked-by: Krzysztof Helt <redacted>
quoted hunk ↗ jump to hunk
diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c
index e327b84..02e7a72 100644
--- a/drivers/video/via/viafbdev.c
+++ b/drivers/video/via/viafbdev.c
@@ -2103,7 +2106,7 @@ static void viafb_remove_proc(struct proc_dir_entry *viafb_entry)
 
 static int __devinit via_pci_probe(void)
 {
-	unsigned int default_xres, default_yres;
+	unsigned long default_xres, default_yres;
 	char *tmpc, *tmpm;
 	char *tmpc_sec, *tmpm_sec;
 	int vmode_index;
@@ -2196,8 +2199,8 @@ static int __devinit via_pci_probe(void)
 	viafb_FB_MM = viaparinfo->fbmem_virt;
 	tmpm = viafb_mode;
 	tmpc = strsep(&tmpm, "x");
-	strict_strtoul(tmpc, 0, (unsigned long *)&default_xres);
-	strict_strtoul(tmpm, 0, (unsigned long *)&default_yres);
+	strict_strtoul(tmpc, 0, &default_xres);
+	strict_strtoul(tmpm, 0, &default_yres);
 
 	vmode_index = viafb_get_mode_index(default_xres, default_yres, 0);
 	DEBUG_MSG(KERN_INFO "0->index=%d\n", vmode_index);
-- 
- Harald Welte <HaraldWelte@viatech.com>	    http://linux.via.com.tw/
============================================================================
VIA Open Source Liaison
----------------------------------------------------------------------
Doladuj telefon! 
Sprawdz >> http://link.interia.pl/f215b


------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help