Re: [PATCH] block: genhd: Use struct_size() helper

2019-06-15 Thread Jens Axboe
On 5/31/19 12:47 PM, Gustavo A. R. Silva wrote: > Make use of the struct_size() helper instead of an open-coded version > in order to avoid any potential type mistakes, in particular in the > context in which this code is being used. > > So, replace the following form: > > sizeof(*new_ptbl) + tar

[PATCH] block: genhd: Use struct_size() helper

2019-05-31 Thread Gustavo A. R. Silva
Make use of the struct_size() helper instead of an open-coded version in order to avoid any potential type mistakes, in particular in the context in which this code is being used. So, replace the following form: sizeof(*new_ptbl) + target * sizeof(new_ptbl->part[0]) with: struct_size(new_ptbl,