[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <87efp00xss.fsf@miraculix.mork.no>
Date: Wed, 15 Nov 2017 09:08:03 +0100
From: Bjørn Mork <bjorn@...k.no>
To: Ben Hutchings <ben.hutchings@...ethink.co.uk>
Cc: Enrico Mioso <mrkiko.rs@...il.com>,
Christian Panton <christian@...ton.org>,
linux-usb@...r.kernel.org, netdev@...r.kernel.org,
Oliver Neukum <oliver@...kum.org>,
"David S. Miller" <davem@...emloft.net>,
Porto Rio <porto.rio@....net>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Subject: Re: [PATCH 4.4 27/56] cdc_ncm: Set NTB format again after altsetting switch for Huawei devices
Ben Hutchings <ben.hutchings@...ethink.co.uk> writes:
> On Tue, 2017-07-11 at 17:21 +0200, Enrico Mioso wrote:
>> From: Enrico Mioso <mrkiko.rs@...il.com>
>>
>> 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
Powered by blists - more mailing lists