]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
Drivers: hv: use kmalloc_array() instead of kmalloc()
authorGongwei Li <ligongwei@kylinos.cn>
Fri, 21 Nov 2025 03:10:41 +0000 (11:10 +0800)
committerWei Liu <wei.liu@kernel.org>
Fri, 5 Dec 2025 23:16:49 +0000 (23:16 +0000)
Replace kmalloc() with kmalloc_array() to prevent potential
overflow, as recommended in Documentation/process/deprecated.rst.

Signed-off-by: Gongwei Li <ligongwei@kylinos.cn>
Signed-off-by: Wei Liu <wei.liu@kernel.org>
drivers/hv/hv_util.c

index 36ee89c0358bd0df0dc35ffddd1504f0359f0e0a..7e9c8e169c66a6c35fb6b5ee7e581a11028ae1e2 100644 (file)
@@ -586,7 +586,7 @@ static int util_probe(struct hv_device *dev,
                (struct hv_util_service *)dev_id->driver_data;
        int ret;
 
-       srv->recv_buffer = kmalloc(HV_HYP_PAGE_SIZE * 4, GFP_KERNEL);
+       srv->recv_buffer = kmalloc_array(4, HV_HYP_PAGE_SIZE, GFP_KERNEL);
        if (!srv->recv_buffer)
                return -ENOMEM;
        srv->channel = dev->channel;