Skip to contentSkip to conversation

fbcon: Fix endian bug in fbcon_putc (console mouse problem)

PATCH New Antonino A. Daplas 1 participant 1 message Oct 27, 2004

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fbcon: Fix endian bug in fbcon_putc (console mouse problem)

The typecast (const unsigned short *) &c in fbcon_putc is not correct for big-endian machines. This problem manifests as a black cursor that can be used to erase the console screen contents. The correct fix is to use scr_writew instead.

---
 fbcon.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletion(-)
drivers/video/console/fbcon.c +4 -1
diff -Nru a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c
@@ -1012,7 +1012,10 @@
 
 static void fbcon_putc(struct vc_data *vc, int c, int ypos, int xpos)
 {
-	fbcon_putcs(vc, (const unsigned short *) &c, 1, ypos, xpos);
+	unsigned short chr;
+
+	scr_writew(c, &chr);
+	fbcon_putcs(vc, &chr, 1, ypos, xpos);
 }
 
 static void fbcon_clear_margins(struct vc_data *vc, int bottom_only)

-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click