drivers/staging/gasket: Use 2-factor allocator calls

As already done treewide, switch from open-coded multiplication to using
2-factor allocator helpers.

Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Kees Cook
2018-07-04 10:31:25 -07:00
committed by Alex Van Damme
parent 0305c1f77f
commit e1c8e7a804
4 changed files with 21 additions and 18 deletions

View File

@@ -1697,9 +1697,9 @@ static int gasket_mmap(struct file *filp, struct vm_area_struct *vma)
return -EPERM;
}
num_map_regions = bar_desc->num_mappable_regions;
map_regions = kzalloc(
num_map_regions * sizeof(*bar_desc->mappable_regions),
GFP_KERNEL);
map_regions = kcalloc(num_map_regions,
sizeof(*bar_desc->mappable_regions),
GFP_KERNEL);
if (map_regions) {
memcpy(map_regions, bar_desc->mappable_regions,
num_map_regions *