Re: [PATCH 05/26] RDMA/erdma: use array_size

From: Cheng Xu
Date: Tue Jun 27 2023 - 05:32:55 EST




On 6/24/23 5:14 AM, Julia Lawall wrote:
> Use array_size to protect against multiplication overflows.
>
> The changes were done using the following Coccinelle semantic patch:
>
> // <smpl>
> @@
> expression E1, E2;
> constant C1, C2;
> identifier alloc = {vmalloc,vzalloc};
> @@
>
> (
> alloc(C1 * C2,...)
> |
> alloc(
> - (E1) * (E2)
> + array_size(E1, E2)
> ,...)
> )
> // </smpl>
>
> Signed-off-by: Julia Lawall <Julia.Lawall@xxxxxxxx>
>
> ---
> drivers/infiniband/hw/erdma/erdma_verbs.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)

Thanks,

Acked-by: Cheng Xu <chengyou@xxxxxxxxxxxxxxxxx>