Re: [PATCH v2 1/2] VMCI: Remove handle_arr_calc_size()

From: Kees Cook
Date: Tue Dec 12 2023 - 16:35:01 EST


On Sat, Dec 09, 2023 at 01:36:14PM +0100, Christophe JAILLET wrote:
> Use struct_size() instead of handle_arr_calc_size().
> This is much more conventional.
>
> While at it, use size_add() when computing the needed size in
> vmci_handle_arr_append_entry(). This prevents from (unlikely) overflow
> when computing the new size to reallocate.
>
> Suggested-by: Kees Cook <keescook@xxxxxxxxxxxx>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@xxxxxxxxxx>

Reviewed-by: Kees Cook <keescook@xxxxxxxxxxxx>

--
Kees Cook