endianness violation in mos7720 driver

Oliver Neukum <[email protected]>
Newsgroups gmane.linux.usb.devel
Organization Novell
Message-ID <[email protected]>
Hi,

there is a gross endianness violation in mos7720_interrupt_callback.
You cannot assume that you can simply cast into unsigned int data
coming over the wire.

Could you clarify which order is the correct wire order?

	Regards
		Oliver
-- 
SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg)
This signature is a legal requirement
--------

--- linux-2.6.21-rc3-git7/drivers/usb/serial/mos7720.c.alt	2007-03-13 09:33:49.000000000 +0100
+++ linux-2.6.21-rc3-git7/drivers/usb/serial/mos7720.c	2007-03-13 09:34:32.000000000 +0100
@@ -103,8 +103,7 @@
 {
 	int result;
 	int length;
-	__u32 *data;
-	unsigned int status;
+	__u8 *data;
 	__u8 sp1;
 	__u8 sp2;
 	__u8 st;
@@ -146,11 +145,16 @@
 		return;
 	}
 
-	status = *data;
-
+	/*FIXME: the old code is contrary to the comment above*/
+#if 0
 	sp1 = (status & 0xff000000)>>24;
 	sp2 = (status & 0x00ff0000)>>16;
 	st = status & 0x000000ff;
+#endif
+
+	sp1 = data[3];
+	sp2 = data[2];
+	st = data[0];
 
 	if ((sp1 & 0x01) || (sp2 & 0x01)) {
 		/* No Interrupt Pending in both the ports */

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.