treewide: Use array_size() in vzalloc()
[linux-block.git] / lib / test_firmware.c
index cee000ac54d8d6813e6226851fe71dcaaa2fad48..b984806d7d7bb1f4665ffe6cecfa5849aecc8c22 100644 (file)
@@ -618,8 +618,9 @@ static ssize_t trigger_batched_requests_store(struct device *dev,
 
        mutex_lock(&test_fw_mutex);
 
-       test_fw_config->reqs = vzalloc(sizeof(struct test_batched_req) *
-                                      test_fw_config->num_requests * 2);
+       test_fw_config->reqs =
+               vzalloc(array3_size(sizeof(struct test_batched_req),
+                                   test_fw_config->num_requests, 2));
        if (!test_fw_config->reqs) {
                rc = -ENOMEM;
                goto out_unlock;
@@ -720,8 +721,9 @@ ssize_t trigger_batched_requests_async_store(struct device *dev,
 
        mutex_lock(&test_fw_mutex);
 
-       test_fw_config->reqs = vzalloc(sizeof(struct test_batched_req) *
-                                      test_fw_config->num_requests * 2);
+       test_fw_config->reqs =
+               vzalloc(array3_size(sizeof(struct test_batched_req),
+                                   test_fw_config->num_requests, 2));
        if (!test_fw_config->reqs) {
                rc = -ENOMEM;
                goto out;