Re: [PATCH] usb: gadget: f_fs: OS descriptors support

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

 



On Wed, Jul 02 2014, David Laight <David.Laight@xxxxxxxxxx> wrote:
> From: Andrzej Pietrasiewicz
>> Sent: 02 July 2014 12:20
>> To: linux-usb@xxxxxxxxxxxxxxx; Michal Nazarewicz; Felipe Balbi; Greg Kroah-Hartman; Marek Szyprowski
>> Subject: Re: [PATCH] usb: gadget: f_fs: OS descriptors support
>> 
>> W dniu 02.07.2014 13:04, Peter Stuge pisze:
>> > Andrzej Pietrasiewicz wrote:
>> >> +++ b/include/uapi/linux/usb/functionfs.h
>> >> @@ -33,6 +32,42 @@ struct usb_endpoint_descriptor_no_audio {
>> > ..
>> >> +/* MS OS Extended Compatibility Descriptor header */
>> >> +struct usb_ext_compat_desc_header {
>> >> +	struct	usb_os_desc_header header;
>> >> +	__u8	bCount;
>> >> +	__u8	Reserved;
>> >> +} __attribute__((packed));
>> >> +
>> >> +struct usb_ext_compat_desc {
>> >> +	__u8	bFirstInterfaceNumber;
>> >> +	__u8	Reserved1;
>> >> +	__u8	CompatibleID[8];
>> >> +	__u8	SubCompatibleID[8];
>> >> +	__u8	Reserved2[6];
>> >> +};
>> >
>> > Shouldn't usb_ext_compat_desc be packed too, like all the others?
>> >
>> Good catch, thanks!
>
> In this case it is completely pointless - all the fields are byte aligned.
>
> Alternatively it shouldn't be 'packed', and a full audit of the
> other structures done to determine which ones can ever be misaligned
> and then determine whether that should actually be allowed.

All of the structures describe a wire protocol, whether we thing the
structure can be allowed or not is inconsequential since that's what is
being used.  All of those structures must be packed.

-- 
Best regards,                                         _     _
.o. | Liege of Serenely Enlightened Majesty of      o' \,=./ `o
..o | Computer Science,  Michał “mina86” Nazarewicz    (o o)
ooo +--<mpn@xxxxxxxxxx>--<xmpp:mina86@xxxxxxxxxx>--ooO--(_)--Ooo--
--
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