]> git.itanic.dy.fi Git - linux-stable/commit
VMCI: Remove handle_arr_calc_size()
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Sat, 9 Dec 2023 12:36:14 +0000 (13:36 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 15 Dec 2023 16:27:04 +0000 (17:27 +0100)
commitbda910d81843228c18d1ac51af6b149f2e8261c7
tree2feef0e5e55d1da1123b9042835a003ca128bdc6
parentc49739235c426b05539589de2ffde2bbf71ae468
VMCI: Remove handle_arr_calc_size()

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@chromium.org>
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/84e7f2d8e7c4c2eab68f958307d56546978f76e3.1702125347.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/misc/vmw_vmci/vmci_handle_array.c