Re: [PATCH 1/2] um: add uml_kmalloc_array() helper to avoid potential

From: Johannes Berg

Date: Wed Jul 22 2026 - 10:53:02 EST


On Tue, 2026-01-20 at 19:28 +0800, iamhswang@xxxxxxxxx wrote:
> From: Haisu Wang <iamhswang@xxxxxxxxx>
>
> Add uml_kmalloc_array to avoid potential dynamic multiplication
> overflow. Since in Documentation/process/deprecated.rst,
> the preferred way is avoid the open-coded arithmetic.

Personally, I think it's kind of pointless because the only two users
have small static arguments ... but if you want to continue with this
then
>
> +extern void *uml_kmalloc_array(int count, int size, int flags);

the prototype should probably match better and use size_t, size_t,
unsigned int?

johannes