Re: [PATCH][next] NTB/msi: Use struct_size() helper in devm_kzalloc()

From: Logan Gunthorpe
Date: Fri Jan 21 2022 - 11:25:09 EST





On 2022-01-20 4:02 p.m., 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 or integer overflows that,
> in the worst scenario, could lead to heap overflows.
>
> Also, address the following sparse warnings:
> drivers/ntb/msi.c:46:23: warning: using sizeof on a flexible structure
>
> Link: https://github.com/KSPP/linux/issues/174
> Signed-off-by: Gustavo A. R. Silva <gustavoars@xxxxxxxxxx>

Thanks, looks good to me.

Reviewed-by: Logan Gunthorpe <logang@xxxxxxxxxxxx>