Re: [PATCH v2] udf: Use kvzalloc() in udf_sb_alloc_bitmap()

From: Denis Efremov
Date: Thu Aug 27 2020 - 18:07:44 EST




On 8/28/20 1:09 AM, Gustavo A. R. Silva wrote:
>
>
> On 8/27/20 16:25, Denis Efremov wrote:
>> Use kvzalloc() in udf_sb_alloc_bitmap() instead of open-coding it.
>> Size computation wrapped in struct_size() macro to prevent potential
>> integer overflows.
>>
>> Signed-off-by: Denis Efremov <efremov@xxxxxxxxx>
>> ---
>
> Please, comment here what changed in v2, vn... e.g.:
>
> Changes in v2:
> - Use struct_size() helper.
>

Ah, thanks. I added this initially and accidentally regenerated the patch
file with format-patch.

>
> Why not this:
>
> bitmap = kvzalloc(struct_size(bitmap, s_block_bitmap, nr_groups),
> GFP_KERNEL);
>
> and you can also get rid of _size_ entirely.
>

My bad, I missed that only nr_groups is used down the code.

Thanks, I will resend it as v3.

Denis