]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
mshv: use kmalloc_array in mshv_root_scheduler_init
authorCan Peng <pengcan@kylinos.cn>
Wed, 20 May 2026 07:16:32 +0000 (15:16 +0800)
committerWei Liu <wei.liu@kernel.org>
Wed, 27 May 2026 22:26:23 +0000 (15:26 -0700)
Replace kmalloc() with kmalloc_array() to prevent potential
overflow, as recommended in Documentation/process/deprecated.rst.

No functional change.

Signed-off-by: Can Peng <pengcan@kylinos.cn>
Signed-off-by: Wei Liu <wei.liu@kernel.org>
drivers/hv/mshv_root_main.c

index bd1359eb58dd46d31d1ef3e5aed3e2382689fe73..146726cc4e9ba83025acebc81c0d6eb9302a27ab 100644 (file)
@@ -2241,7 +2241,7 @@ static int mshv_root_scheduler_init(unsigned int cpu)
        outputarg = (void **)this_cpu_ptr(root_scheduler_output);
 
        /* Allocate two consecutive pages. One for input, one for output. */
-       p = kmalloc(2 * HV_HYP_PAGE_SIZE, GFP_KERNEL);
+       p = kmalloc_array(2, HV_HYP_PAGE_SIZE, GFP_KERNEL);
        if (!p)
                return -ENOMEM;