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

@@ -136,23 +136,26 @@ int gasket_interrupt_init(
interrupt_data->wire_interrupt_offsets = wire_int_offsets;
/* Allocate all dynamic structures. */
interrupt_data->msix_entries = kzalloc(
sizeof(struct msix_entry) * num_interrupts, GFP_KERNEL);
interrupt_data->msix_entries = kcalloc(num_interrupts,
sizeof(struct msix_entry),
GFP_KERNEL);
if (!interrupt_data->msix_entries) {
kfree(interrupt_data);
return -ENOMEM;
}
interrupt_data->eventfd_ctxs = kzalloc(
sizeof(struct eventfd_ctx *) * num_interrupts, GFP_KERNEL);
interrupt_data->eventfd_ctxs = kcalloc(num_interrupts,
sizeof(struct eventfd_ctx *),
GFP_KERNEL);
if (!interrupt_data->eventfd_ctxs) {
kfree(interrupt_data->msix_entries);
kfree(interrupt_data);
return -ENOMEM;
}
interrupt_data->interrupt_counts = kzalloc(
sizeof(ulong) * num_interrupts, GFP_KERNEL);
interrupt_data->interrupt_counts = kcalloc(num_interrupts,
sizeof(ulong),
GFP_KERNEL);
if (!interrupt_data->interrupt_counts) {
kfree(interrupt_data->eventfd_ctxs);
kfree(interrupt_data->msix_entries);