Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1174119 > unrolled thread
| Started by | Ray Jui <rjui@broadcom.com> |
|---|---|
| First post | 2015-06-29 23:30 +0200 |
| Last post | 2015-06-29 23:40 +0200 |
| Articles | 4 — 1 participant |
Back to article view | Back to linux.kernel
[PATCH 0/2] iProc clock driver fixes Ray Jui <rjui@broadcom.com> - 2015-06-29 23:30 +0200
[PATCH 1/2] clk: iproc: fix memory leak from clock name Ray Jui <rjui@broadcom.com> - 2015-06-29 23:40 +0200
Re: [PATCH 1/2] clk: iproc: fix memory leak from clock name Ray Jui <rjui@broadcom.com> - 2015-06-29 23:40 +0200
Re: [PATCH 0/2] iProc clock driver fixes Ray Jui <rjui@broadcom.com> - 2015-06-29 23:40 +0200
| From | Ray Jui <rjui@broadcom.com> |
|---|---|
| Date | 2015-06-29 23:30 +0200 |
| Subject | [PATCH 0/2] iProc clock driver fixes |
| Message-ID | <pGOMQ-6LO-51@gated-at.bofh.it> |
This patch series fixes two issues in the Broadcom iProc clock driver, reported by Dan Carpenter <dan.carpenter@oracle.com>: 1) a memory leak from the clock names; 2) 32-bit/64-bit arithmetic Code base used is the latest linux-next (20150629) and its GITHUB link is: https://github.com/Broadcom/cygnus-linux/tree/iproc-clk-misc-fix-v1 Ray Jui (2): clk: iproc: fix memory leak from clock name clk: iproc: fix bit manipulation arithmetic drivers/clk/bcm/clk-iproc-asiu.c | 6 +----- drivers/clk/bcm/clk-iproc-pll.c | 13 ++++--------- 2 files changed, 5 insertions(+), 14 deletions(-) -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Ray Jui <rjui@broadcom.com> |
|---|---|
| Date | 2015-06-29 23:40 +0200 |
| Subject | [PATCH 1/2] clk: iproc: fix memory leak from clock name |
| Message-ID | <pGOWv-6XR-23@gated-at.bofh.it> |
| In reply to | #1174119 |
of_property_read_string_index takes array of pointers and assign them to
strings read from device tree property. No additional memory allocation
is needed prior to calling of_property_read_string_index. In fact, since
the array of pointers will be re-assigned to other strings, any memory
that it points to prior to calling of_property_read_string_index will be
leaked
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Ray Jui <rjui@broadcom.com>
---
drivers/clk/bcm/clk-iproc-asiu.c | 6 +-----
drivers/clk/bcm/clk-iproc-pll.c | 8 +-------
2 files changed, 2 insertions(+), 12 deletions(-)
diff --git a/drivers/clk/bcm/clk-iproc-asiu.c b/drivers/clk/bcm/clk-iproc-asiu.c
index e19c09c..f630e1b 100644
--- a/drivers/clk/bcm/clk-iproc-asiu.c
+++ b/drivers/clk/bcm/clk-iproc-asiu.c
@@ -222,10 +222,6 @@ void __init iproc_asiu_setup(struct device_node *node,
struct iproc_asiu_clk *asiu_clk;
const char *clk_name;
- clk_name = kzalloc(IPROC_CLK_NAME_LEN, GFP_KERNEL);
- if (WARN_ON(!clk_name))
- goto err_clk_register;
-
ret = of_property_read_string_index(node, "clock-output-names",
i, &clk_name);
if (WARN_ON(ret))
@@ -259,7 +255,7 @@ void __init iproc_asiu_setup(struct device_node *node,
err_clk_register:
for (i = 0; i < num_clks; i++)
- kfree(asiu->clks[i].name);
+ clk_unregister(asiu->clk_data.clks[i]);
iounmap(asiu->gate_base);
err_iomap_gate:
diff --git a/drivers/clk/bcm/clk-iproc-pll.c b/drivers/clk/bcm/clk-iproc-pll.c
index 46fb84b..a8d971b 100644
--- a/drivers/clk/bcm/clk-iproc-pll.c
+++ b/drivers/clk/bcm/clk-iproc-pll.c
@@ -655,10 +655,6 @@ void __init iproc_pll_clk_setup(struct device_node *node,
memset(&init, 0, sizeof(init));
parent_name = node->name;
- clk_name = kzalloc(IPROC_CLK_NAME_LEN, GFP_KERNEL);
- if (WARN_ON(!clk_name))
- goto err_clk_register;
-
ret = of_property_read_string_index(node, "clock-output-names",
i, &clk_name);
if (WARN_ON(ret))
@@ -690,10 +686,8 @@ void __init iproc_pll_clk_setup(struct device_node *node,
return;
err_clk_register:
- for (i = 0; i < num_clks; i++) {
- kfree(pll->clks[i].name);
+ for (i = 0; i < num_clks; i++)
clk_unregister(pll->clk_data.clks[i]);
- }
err_pll_register:
if (pll->asiu_base)
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Ray Jui <rjui@broadcom.com> |
|---|---|
| Date | 2015-06-29 23:40 +0200 |
| Subject | Re: [PATCH 1/2] clk: iproc: fix memory leak from clock name |
| Message-ID | <pGOWy-6XR-93@gated-at.bofh.it> |
| In reply to | #1174121 |
+ Michael's new email
On 6/29/2015 2:30 PM, Ray Jui wrote:
> of_property_read_string_index takes array of pointers and assign them to
> strings read from device tree property. No additional memory allocation
> is needed prior to calling of_property_read_string_index. In fact, since
> the array of pointers will be re-assigned to other strings, any memory
> that it points to prior to calling of_property_read_string_index will be
> leaked
>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Ray Jui <rjui@broadcom.com>
> ---
> drivers/clk/bcm/clk-iproc-asiu.c | 6 +-----
> drivers/clk/bcm/clk-iproc-pll.c | 8 +-------
> 2 files changed, 2 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/clk/bcm/clk-iproc-asiu.c b/drivers/clk/bcm/clk-iproc-asiu.c
> index e19c09c..f630e1b 100644
> --- a/drivers/clk/bcm/clk-iproc-asiu.c
> +++ b/drivers/clk/bcm/clk-iproc-asiu.c
> @@ -222,10 +222,6 @@ void __init iproc_asiu_setup(struct device_node *node,
> struct iproc_asiu_clk *asiu_clk;
> const char *clk_name;
>
> - clk_name = kzalloc(IPROC_CLK_NAME_LEN, GFP_KERNEL);
> - if (WARN_ON(!clk_name))
> - goto err_clk_register;
> -
> ret = of_property_read_string_index(node, "clock-output-names",
> i, &clk_name);
> if (WARN_ON(ret))
> @@ -259,7 +255,7 @@ void __init iproc_asiu_setup(struct device_node *node,
>
> err_clk_register:
> for (i = 0; i < num_clks; i++)
> - kfree(asiu->clks[i].name);
> + clk_unregister(asiu->clk_data.clks[i]);
> iounmap(asiu->gate_base);
>
> err_iomap_gate:
> diff --git a/drivers/clk/bcm/clk-iproc-pll.c b/drivers/clk/bcm/clk-iproc-pll.c
> index 46fb84b..a8d971b 100644
> --- a/drivers/clk/bcm/clk-iproc-pll.c
> +++ b/drivers/clk/bcm/clk-iproc-pll.c
> @@ -655,10 +655,6 @@ void __init iproc_pll_clk_setup(struct device_node *node,
> memset(&init, 0, sizeof(init));
> parent_name = node->name;
>
> - clk_name = kzalloc(IPROC_CLK_NAME_LEN, GFP_KERNEL);
> - if (WARN_ON(!clk_name))
> - goto err_clk_register;
> -
> ret = of_property_read_string_index(node, "clock-output-names",
> i, &clk_name);
> if (WARN_ON(ret))
> @@ -690,10 +686,8 @@ void __init iproc_pll_clk_setup(struct device_node *node,
> return;
>
> err_clk_register:
> - for (i = 0; i < num_clks; i++) {
> - kfree(pll->clks[i].name);
> + for (i = 0; i < num_clks; i++)
> clk_unregister(pll->clk_data.clks[i]);
> - }
>
> err_pll_register:
> if (pll->asiu_base)
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Ray Jui <rjui@broadcom.com> |
|---|---|
| Date | 2015-06-29 23:40 +0200 |
| Message-ID | <pGOWx-6XR-69@gated-at.bofh.it> |
| In reply to | #1174119 |
To Michael's new email. On 6/29/2015 2:30 PM, Ray Jui wrote: > This patch series fixes two issues in the Broadcom iProc clock driver, > reported by Dan Carpenter <dan.carpenter@oracle.com>: 1) a memory leak from > the clock names; 2) 32-bit/64-bit arithmetic > > Code base used is the latest linux-next (20150629) and its GITHUB link is: > https://github.com/Broadcom/cygnus-linux/tree/iproc-clk-misc-fix-v1 > > Ray Jui (2): > clk: iproc: fix memory leak from clock name > clk: iproc: fix bit manipulation arithmetic > > drivers/clk/bcm/clk-iproc-asiu.c | 6 +----- > drivers/clk/bcm/clk-iproc-pll.c | 13 ++++--------- > 2 files changed, 5 insertions(+), 14 deletions(-) > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web