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

Johannes Berg johannes at sipsolutions.net
Wed Jul 22 07:49:12 PDT 2026


On Tue, 2026-01-20 at 19:28 +0800, iamhswang at gmail.com wrote:
> From: Haisu Wang <iamhswang at gmail.com>
> 
> 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



More information about the linux-um mailing list