Re: [PATCH 4.4 27/56] cdc_ncm: Set NTB format again after altsetting switch for Huawei devices

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ben Hutchings <ben.hutchings@xxxxxxxxxxxxxxx> writes:
> On Tue, 2017-07-11 at 17:21 +0200, Enrico Mioso wrote:
>> From: Enrico Mioso <mrkiko.rs@xxxxxxxxx>
>> 
>> commit 2b02c20ce0c28974b44e69a2e2f5ddc6a470ad6f upstream.
> [...]
>> --- a/drivers/net/usb/cdc_ncm.c
>> +++ b/drivers/net/usb/cdc_ncm.c
>> @@ -724,8 +724,10 @@ int cdc_ncm_bind_common(struct usbnet *d
>>  	u8 *buf;
>>  	int len;
>>  	int temp;
>> +	int err;
>> 	u8 iface_no;
>> 	struct usb_cdc_parsed_header hdr;
>> +	u16 curr_ntb_format;
> [...]
>> +		err = usbnet_read_cmd(dev, USB_CDC_GET_NTB_FORMAT,
>> +				      USB_TYPE_CLASS | USB_DIR_IN | USB_RECIP_INTERFACE,
>> +				      0, iface_no, &curr_ntb_format, 2);
>> +		if (err < 0) {
>> +			goto error2;
>> +		}
>> +
>> +		if (curr_ntb_format == USB_CDC_NCM_NTB32_FORMAT) {
> [...]
>
> usbnet_read_cmd() doesn't do any byte-swapping, so it looks like
> curr_ntb_format will have little-endian byte order (__le16 not u16). 
> The comparison will then need to be done using
> le16_to_cpu(curr_ntb_format).

Right.  Thanks.  Fix coming up ASAP.

I cannot explain why since we are obviously reading and writing 2 bytes
here, but for some reason I've always thought of this value as 8 bit.


Bjørn
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux