lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1461851433-19365-1-git-send-email-vaishali.thakkar@oracle.com>
Date:	Thu, 28 Apr 2016 19:20:33 +0530
From:	Vaishali Thakkar <vaishali.thakkar@...cle.com>
To:	mturquette@...libre.com
Cc:	linux-clk@...r.kernel.org, linux-kernel@...r.kernel.org,
	sboyd@...eaurora.org,
	Vaishali Thakkar <vaishali.thakkar@...cle.com>
Subject: [PATCH] clk: bcm/kona: Do not use sizeof on pointer type

When sizeof is applied to a pointer typed expression, it gives
the size of the pointer. So, here do not use sizeof on pointer
type. Also, silent checkpatch.pl by using kmalloc_array over
kmalloc.

Note that this has no effect on runtime because 'parent_names'
is a pointer to a pointer.

Problem found using Coccinelle.

Signed-off-by: Vaishali Thakkar <vaishali.thakkar@...cle.com>
---
 drivers/clk/bcm/clk-kona-setup.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/bcm/clk-kona-setup.c b/drivers/clk/bcm/clk-kona-setup.c
index deaa7f9..526b0b0 100644
--- a/drivers/clk/bcm/clk-kona-setup.c
+++ b/drivers/clk/bcm/clk-kona-setup.c
@@ -577,7 +577,8 @@ static u32 *parent_process(const char *clocks[],
 	 * selector is not required, but we allocate space for the
 	 * array anyway to keep things simple.
 	 */
-	parent_names = kmalloc(parent_count * sizeof(parent_names), GFP_KERNEL);
+	parent_names = kmalloc_array(parent_count, sizeof(*parent_names),
+			       GFP_KERNEL);
 	if (!parent_names) {
 		pr_err("%s: error allocating %u parent names\n", __func__,
 				parent_count);
-- 
2.1.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ