Merge tag 'for-linus-4.18-rc2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git...
[muen/linux.git] / drivers / xen / grant-table.c
index ba36ff3e49036aebcd3bd4342c76924d46e30082..ba9f3eec2bd00f6f39eb952ed5815e7b45c9735e 100644 (file)
@@ -1137,7 +1137,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(nr_gframes * sizeof(unsigned long), GFP_ATOMIC);
+       frames = kmalloc_array(nr_gframes, sizeof(unsigned long), GFP_ATOMIC);
        if (!frames)
                return -ENOMEM;
 
@@ -1300,8 +1300,9 @@ int gnttab_init(void)
        max_nr_glist_frames = (max_nr_grant_frames *
                               gnttab_interface->grefs_per_grant_frame / RPP);
 
-       gnttab_list = kmalloc(max_nr_glist_frames * sizeof(grant_ref_t *),
-                             GFP_KERNEL);
+       gnttab_list = kmalloc_array(max_nr_glist_frames,
+                                   sizeof(grant_ref_t *),
+                                   GFP_KERNEL);
        if (gnttab_list == NULL)
                return -ENOMEM;