Re: [PATCH 10/16] usb/gadget: FunctionFS: Remove VLAIS usage from gadget code

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

 



On 11/08/2013 04:01 PM, Andrzej Pietrasiewicz wrote:
> Hello Sebastian,

Hallo Andrzej,

> Please correct me if I'm wrong but I think it is not possible to use
> usb_gstrings_attach(). Basically, usb_gstrings_attach() requires
> 
> struct usb_gadget_strings **sp
> 
> on input, then it does copy_gadget_strings(sp, n_gstrings, n_strings);
> and then does its job. So actually to do usb_gstrings_attach() you need
> to _already_ have struct usb_gadget_strings **sp.
> 
> FunctionFS is different in that it takes data to _build_
> usb_gadget_strings **stringtabs from userspace (the char *const _data).
> In other words, the string descriptors are provided from userspace as
> a character buffer which needs to be parsed and it is what
> __ffs_data_got_strings() does.

You are right.
So you would have to assume sane upper values for str_count and
lang_count or allocate the three arrays separately. Later you need to
parse that buffer anyway so there is not much win except that the
strings are handled the same way like in other places.
I mean what happens if you use that F_FS as a configfs gadget push
strings via that interface and later change them in userland?

Anyway, this is just a suggestion how you could get rid of the VLAIS
and the macro magic. If you feel this is something between irrelevant
and "don't gain much" continue as you wish.

> 
> Andrzej

Sebastian

--
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