public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Felipe Ferreri Tonello <eu@felipetonello.com>
To: Michal Nazarewicz <mina86@mina86.com>,
	Felipe Balbi <balbi@ti.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Dan Carpenter <dan.carpenter@oracle.com>
Cc: Robert Baldyga <r.baldyga@samsung.com>,
	Andrzej Pietrasiewicz <andrzej.p@samsung.com>,
	Pawel Szewczyk <p.szewczyk@samsung.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCHv2 1/2] usb: gadget: f_midi: use flexible array member for gmidi_in_port elements
Date: Tue, 19 Jan 2016 09:46:23 +0000	[thread overview]
Message-ID: <569E05EF.4070808@felipetonello.com> (raw)
In-Reply-To: <xa1tbn8iq3je.fsf@mina86.com>

[-- Attachment #1: Type: text/plain, Size: 1266 bytes --]

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

[-- Attachment #2: 0x92698E6A.asc --]
[-- Type: application/pgp-keys, Size: 7195 bytes --]

      reply	other threads:[~2016-01-19  9:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-09  3:47 [PATCHv2 1/2] usb: gadget: f_midi: use flexible array member for gmidi_in_port elements Michal Nazarewicz
2016-01-09  3:47 ` [PATCH 2/2] usb: gadget: f_midi: missing unlock on error path Michal Nazarewicz
2016-01-13 18:29   ` Felipe Ferreri Tonello
2016-01-13 18:26 ` [PATCHv2 1/2] usb: gadget: f_midi: use flexible array member for gmidi_in_port elements Felipe Ferreri Tonello
2016-01-13 20:41   ` Dan Carpenter
2016-01-18 16:02   ` Michal Nazarewicz
2016-01-19  9:46     ` Felipe Ferreri Tonello [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=569E05EF.4070808@felipetonello.com \
    --to=eu@felipetonello.com \
    --cc=andrzej.p@samsung.com \
    --cc=balbi@ti.com \
    --cc=dan.carpenter@oracle.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mina86@mina86.com \
    --cc=p.szewczyk@samsung.com \
    --cc=r.baldyga@samsung.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox