[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3af3b2e0-7cca-033c-da7e-caa1c62e20bb@users.sourceforge.net>
Date: Mon, 5 Sep 2016 18:45:05 +0200
From: SF Markus Elfring <elfring@...rs.sourceforge.net>
To: linux-acpi@...r.kernel.org, Hans de Goede <hdegoede@...hat.com>,
Len Brown <lenb@...nel.org>,
"Rafael J. Wysocki" <rjw@...ysocki.net>,
Zhang Rui <rui.zhang@...el.com>
Cc: LKML <linux-kernel@...r.kernel.org>,
kernel-janitors@...r.kernel.org,
Julia Lawall <julia.lawall@...6.fr>,
Paolo Bonzini <pbonzini@...hat.com>
Subject: [PATCH 01/21] ACPI-video: Use kmalloc_array() in
acpi_video_get_levels()
From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Mon, 5 Sep 2016 11:33:30 +0200
A multiplication for the size determination of a memory allocation
indicated that an array data structure should be processed.
Thus use the corresponding function "kmalloc_array".
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
drivers/acpi/acpi_video.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/acpi/acpi_video.c b/drivers/acpi/acpi_video.c
index c5557d0..3d39b53 100644
--- a/drivers/acpi/acpi_video.c
+++ b/drivers/acpi/acpi_video.c
@@ -784,8 +784,9 @@ int acpi_video_get_levels(struct acpi_device *device,
goto out;
}
- br->levels = kmalloc((obj->package.count + 2) * sizeof *(br->levels),
- GFP_KERNEL);
+ br->levels = kmalloc_array(obj->package.count + 2,
+ sizeof(*br->levels),
+ GFP_KERNEL);
if (!br->levels) {
result = -ENOMEM;
goto out_free;
--
2.10.0
Powered by blists - more mailing lists