Re: [PATCH net-next] net: dsa: use struct_size() in devm_kzalloc()

2019-02-08 Thread David Miller
From: "Gustavo A. R. Silva" Date: Thu, 7 Feb 2019 19:16:03 -0600 > One of the more common cases of allocation size calculations is finding > the size of a structure that has a zero-sized array at the end, along > with memory for some number of elements for that array. For example: > > struct foo

Re: [PATCH net-next] net: dsa: use struct_size() in devm_kzalloc()

2019-02-08 Thread Vivien Didelot
On Thu, 7 Feb 2019 19:16:03 -0600, "Gustavo A. R. Silva" wrote: > One of the more common cases of allocation size calculations is finding > the size of a structure that has a zero-sized array at the end, along > with memory for some number of elements for that array. For example: > > struct foo

[PATCH net-next] net: dsa: use struct_size() in devm_kzalloc()

2019-02-07 Thread Gustavo A. R. Silva
One of the more common cases of allocation size calculations is finding the size of a structure that has a zero-sized array at the end, along with memory for some number of elements for that array. For example: struct foo { int stuff; struct boo entry[]; }; size = sizeof(struct foo) + cou