Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1308801
| From | Dan Carpenter <dan.carpenter@oracle.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCHv2 1/2] usb: gadget: f_midi: use flexible array member for gmidi_in_port elements |
| Date | 2016-01-13 21:50 +0100 |
| Message-ID | <qQAwG-50b-21@gated-at.bofh.it> (permalink) |
| References | <qOSHo-88e-3@gated-at.bofh.it> <qQylc-3yp-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Wed, Jan 13, 2016 at 06:26:22PM +0000, Felipe Ferreri Tonello wrote: > > @@ -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? > Yes. It's fine. Zero size arrays at the end of a struct are normal. regards, dan carpenter
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCHv2 1/2] usb: gadget: f_midi: use flexible array member for gmidi_in_port elements Michal Nazarewicz <mina86@mina86.com> - 2016-01-09 04:50 +0100
[PATCH 2/2] usb: gadget: f_midi: missing unlock on error path Michal Nazarewicz <mina86@mina86.com> - 2016-01-09 04:50 +0100
Re: [PATCH 2/2] usb: gadget: f_midi: missing unlock on error path Felipe Ferreri Tonello <eu@felipetonello.com> - 2016-01-13 19:30 +0100
Re: [PATCHv2 1/2] usb: gadget: f_midi: use flexible array member for gmidi_in_port elements Felipe Ferreri Tonello <eu@felipetonello.com> - 2016-01-13 19:30 +0100
Re: [PATCHv2 1/2] usb: gadget: f_midi: use flexible array member for gmidi_in_port elements Dan Carpenter <dan.carpenter@oracle.com> - 2016-01-13 21:50 +0100
csiph-web