forked from MIrrors/gasket-driver
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:
committed by
Alex Van Damme
parent
0305c1f77f
commit
e1c8e7a804
@@ -137,9 +137,9 @@ static void put_mapping(struct gasket_sysfs_mapping *mapping)
|
||||
device = mapping->device;
|
||||
legacy_device = mapping->legacy_device;
|
||||
num_files_to_remove = mapping->attribute_count;
|
||||
files_to_remove = kzalloc(
|
||||
num_files_to_remove * sizeof(*files_to_remove),
|
||||
GFP_KERNEL);
|
||||
files_to_remove = kcalloc(num_files_to_remove,
|
||||
sizeof(*files_to_remove),
|
||||
GFP_KERNEL);
|
||||
for (i = 0; i < num_files_to_remove; i++)
|
||||
files_to_remove[i] = mapping->attributes[i].attr;
|
||||
|
||||
@@ -238,9 +238,9 @@ int gasket_sysfs_create_mapping(
|
||||
kref_init(&mapping->refcount);
|
||||
mapping->device = device;
|
||||
mapping->gasket_dev = gasket_dev;
|
||||
mapping->attributes = kzalloc(
|
||||
GASKET_SYSFS_MAX_NODES * sizeof(*mapping->attributes),
|
||||
GFP_KERNEL);
|
||||
mapping->attributes = kcalloc(GASKET_SYSFS_MAX_NODES,
|
||||
sizeof(*mapping->attributes),
|
||||
GFP_KERNEL);
|
||||
mapping->attribute_count = 0;
|
||||
if (!mapping->attributes) {
|
||||
gasket_nodev_error("Unable to allocate sysfs attribute array.");
|
||||
|
||||
Reference in New Issue
Block a user