From 5d519a058c170f6733bf54c27b54695f30de2030 Mon Sep 17 00:00:00 2001 From: Jan Beulich Date: Thu, 30 Jul 2026 16:57:58 +0200 Subject: [PATCH] Xen/gnttab: adjust two uses of sizeof() The use in gnttab_map() is latently buggy, as "frames" there is xen_pfn_t *, not unsigned long *. Adjust the correct use in gnttab_map_frames_v2() as well, just to avoid the problematic pattern of sizeof(). Signed-off-by: Jan Beulich Reviewed-by: Andrew Cooper Signed-off-by: Juergen Gross Message-ID: <0ddff6c4-7ec7-41a9-9417-687ca16aaafd@suse.com> --- drivers/xen/grant-table.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c index 35f879dc5dfb..69922be28b54 100644 --- a/drivers/xen/grant-table.c +++ b/drivers/xen/grant-table.c @@ -1406,7 +1406,7 @@ static int gnttab_map_frames_v2(xen_pfn_t *frames, unsigned int nr_gframes) /* No need for kzalloc as it is initialized in following hypercall * GNTTABOP_get_status_frames. */ - sframes = kmalloc_array(nr_sframes, sizeof(uint64_t), GFP_ATOMIC); + sframes = kmalloc_array(nr_sframes, sizeof(*sframes), GFP_ATOMIC); if (!sframes) return -ENOMEM; @@ -1478,7 +1478,7 @@ static int gnttab_map(unsigned int start_idx, unsigned int end_idx) /* No need for kzalloc as it is initialized in following hypercall * GNTTABOP_setup_table. */ - frames = kmalloc_array(nr_gframes, sizeof(unsigned long), GFP_ATOMIC); + frames = kmalloc_array(nr_gframes, sizeof(*frames), GFP_ATOMIC); if (!frames) return -ENOMEM;