Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1390233 > unrolled thread
| Started by | Vaishali Thakkar <vaishali.thakkar@oracle.com> |
|---|---|
| First post | 2016-04-28 16:00 +0200 |
| Last post | 2016-05-06 20:10 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] clk: bcm/kona: Do not use sizeof on pointer type Vaishali Thakkar <vaishali.thakkar@oracle.com> - 2016-04-28 16:00 +0200
Re: [PATCH] clk: bcm/kona: Do not use sizeof on pointer type Stephen Boyd <sboyd@codeaurora.org> - 2016-05-06 20:10 +0200
| From | Vaishali Thakkar <vaishali.thakkar@oracle.com> |
|---|---|
| Date | 2016-04-28 16:00 +0200 |
| Subject | [PATCH] clk: bcm/kona: Do not use sizeof on pointer type |
| Message-ID | <rsUE4-41Z-19@gated-at.bofh.it> |
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@oracle.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
[toc] | [next] | [standalone]
| From | Stephen Boyd <sboyd@codeaurora.org> |
|---|---|
| Date | 2016-05-06 20:10 +0200 |
| Message-ID | <rvSmo-1A4-77@gated-at.bofh.it> |
| In reply to | #1390233 |
On 04/28, Vaishali Thakkar wrote: > 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@oracle.com> > --- Applied to clk-next -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web