Re: [PATCH ] cdc_ncm: fixes for big-endian architecture / MIPS

From
David Miller <hidden>
Date
2011-08-03 10:42:53
From: Alexey Orishko <redacted>
Date: Tue,  2 Aug 2011 18:20:26 +0200
quoted hunk
@@ -203,8 +203,8 @@ static u8 cdc_ncm_setup(struct cdc_ncm_ctx *ctx)
 	req.bmRequestType = USB_TYPE_CLASS | USB_DIR_IN | USB_RECIP_INTERFACE;
 	req.bNotificationType = USB_CDC_GET_NTB_PARAMETERS;
 	req.wValue = 0;
-	req.wIndex = cpu_to_le16(iface_no);
-	req.wLength = cpu_to_le16(sizeof(ctx->ncm_parm));
+	req.wIndex = iface_no;
+	req.wLength = sizeof(ctx->ncm_parm);
 
 	err = cdc_ncm_do_request(ctx, &req, &ctx->ncm_parm, 0, NULL, 1000);
 	if (err) {
This can't be correct.

"iface_no" is a u8 we read out of desc->bInterfaceNumber

we still have to extend it to a u16 and convert it to a little endian
16-bit value for the req.wIndex field.

If the types for the cdc notification struct are wrong, that's another
story entirely.  But currently they are marked as __le16 so you must
resolve this first.

Otherwise your changes will result in several new sparse endian
warnings.

I'm not applying this, even if it is correct functionally.

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Thread (1 message) 1 message, 1 author, last reply 2011-08-03
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help