[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <569E05EF.4070808@felipetonello.com>
Date: Tue, 19 Jan 2016 09:46:23 +0000
From: Felipe Ferreri Tonello <eu@...ipetonello.com>
To: Michal Nazarewicz <mina86@...a86.com>, Felipe Balbi <balbi@...com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Dan Carpenter <dan.carpenter@...cle.com>
Cc: Robert Baldyga <r.baldyga@...sung.com>,
Andrzej Pietrasiewicz <andrzej.p@...sung.com>,
Pawel Szewczyk <p.szewczyk@...sung.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCHv2 1/2] usb: gadget: f_midi: use flexible array member for
gmidi_in_port elements
Hi Michal,
On 18/01/16 16:02, Michal Nazarewicz wrote:
>> On 09/01/16 03:47, Michal Nazarewicz wrote:
>>> @@ -55,7 +55,6 @@ static const char f_midi_longname[] = "MIDI Gadget";
>>> * USB <- IN endpoint <- rawmidi
>>> */
>>> struct gmidi_in_port {
>>> - struct f_midi *midi;
>
> On Wed, Jan 13 2016, Felipe Ferreri Tonello wrote:
>> This change is unrelated. I sent a patch removing this pointer as well.
>
> Has it been merged yet? Which branch? Could you point me to the patch?
No, but it is in the mailing list.
"[PATCH 3/4] usb: gadget: f_midi: remove useless midi reference from
port struct" under "[PATCH 0/4] More improvements on MIDI gadget function"
>
>>> int active;
>>> uint8_t cable;
>>> uint8_t state;
>>> @@ -1115,26 +1112,16 @@ static struct usb_function *f_midi_alloc(struct usb_function_instance *fi)
>>> }
>>>
>>> /* allocate and initialize one new instance */
>>> - midi = kzalloc(sizeof(*midi), GFP_KERNEL);
>>> + midi = kzalloc(
>>> + sizeof(*midi) + opts->in_ports * sizeof(*midi->in_ports_array),
>>> + GFP_KERNEL);
>>
>> Is there a garantee that the compiler will always use in_ports_array at
>> the end of the allocated block?
>
> Yep, see <https://en.wikipedia.org/wiki/Flexible_array_member>.
Thanks.
Felipe
Download attachment "0x92698E6A.asc" of type "application/pgp-keys" (7196 bytes)
Powered by blists - more mailing lists