Re: [PATCH] nvme: target: use struct_size() in kmalloc()

2019-05-21 Thread Christoph Hellwig
Looks ok to me, although for a fixed size argument the whole overflow detection thing in struct_size() is rather pointless..

Re: [PATCH] nvme: target: use struct_size() in kmalloc()

2019-05-18 Thread Gustavo A. R. Silva
On 5/17/19 2:03 AM, xiaolinkui wrote: > Use struct_size() to keep code sample. What do you mean by that? > 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

Re: [PATCH] nvme: target: use struct_size() in kmalloc()

2019-05-17 Thread Chaitanya Kulkarni
If maintainers are okay with this then, Reviewed-by: Chaitanya Kulkarni On 5/17/19 12:07 AM, xiaolinkui wrote: > Use struct_size() to keep code sample. > 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,

[PATCH] nvme: target: use struct_size() in kmalloc()

2019-05-17 Thread xiaolinkui
Use struct_size() to keep code sample. 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