Skip to content

Commit b5110ea

Browse files
ligongwei-qmliuw
authored andcommitted
Drivers: hv: use kmalloc_array() instead of kmalloc()
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>
1 parent c720e6a commit b5110ea

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/hv/hv_util.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,7 @@ static int util_probe(struct hv_device *dev,
586586
(struct hv_util_service *)dev_id->driver_data;
587587
int ret;
588588

589-
srv->recv_buffer = kmalloc(HV_HYP_PAGE_SIZE * 4, GFP_KERNEL);
589+
srv->recv_buffer = kmalloc_array(4, HV_HYP_PAGE_SIZE, GFP_KERNEL);
590590
if (!srv->recv_buffer)
591591
return -ENOMEM;
592592
srv->channel = dev->channel;

0 commit comments

Comments
 (0)