* [PATCH] soc: versatile: Add missing kfree in error path
@ 2015-07-17 17:54 ` Christophe JAILLET
0 siblings, 0 replies; 4+ messages in thread
From: Christophe JAILLET @ 2015-07-17 17:54 UTC (permalink / raw)
To: linus.walleij, arnd; +Cc: linux-kernel, kernel-janitors, Christophe JAILLET
If 'of_property_read_string' fails, then 'soc_dev_attr' should be freed,
otherwise, there is a memory leak.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
drivers/soc/versatile/soc-realview.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/soc/versatile/soc-realview.c b/drivers/soc/versatile/soc-realview.c
index e642c45..48bc962 100644
--- a/drivers/soc/versatile/soc-realview.c
+++ b/drivers/soc/versatile/soc-realview.c
@@ -109,8 +109,10 @@ static int realview_soc_probe(struct platform_device *pdev)
ret = of_property_read_string(np, "compatible",
&soc_dev_attr->soc_id);
- if (ret)
+ if (ret) {
+ kfree(soc_dev_attr);
return -EINVAL;
+ }
soc_dev_attr->machine = "RealView";
soc_dev_attr->family = "Versatile";
--
2.1.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] soc: versatile: Add missing kfree in error path
@ 2015-07-17 17:54 ` Christophe JAILLET
0 siblings, 0 replies; 4+ messages in thread
From: Christophe JAILLET @ 2015-07-17 17:54 UTC (permalink / raw)
To: linus.walleij, arnd; +Cc: linux-kernel, kernel-janitors, Christophe JAILLET
If 'of_property_read_string' fails, then 'soc_dev_attr' should be freed,
otherwise, there is a memory leak.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
drivers/soc/versatile/soc-realview.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/soc/versatile/soc-realview.c b/drivers/soc/versatile/soc-realview.c
index e642c45..48bc962 100644
--- a/drivers/soc/versatile/soc-realview.c
+++ b/drivers/soc/versatile/soc-realview.c
@@ -109,8 +109,10 @@ static int realview_soc_probe(struct platform_device *pdev)
ret = of_property_read_string(np, "compatible",
&soc_dev_attr->soc_id);
- if (ret)
+ if (ret) {
+ kfree(soc_dev_attr);
return -EINVAL;
+ }
soc_dev_attr->machine = "RealView";
soc_dev_attr->family = "Versatile";
--
2.1.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] soc: versatile: Add missing kfree in error path
2015-07-17 17:54 ` Christophe JAILLET
@ 2015-07-17 19:51 ` Linus Walleij
-1 siblings, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2015-07-17 19:51 UTC (permalink / raw)
To: Christophe JAILLET; +Cc: Arnd Bergmann, linux-kernel, kernel-janitors
On Fri, Jul 17, 2015 at 7:54 PM, Christophe JAILLET
<christophe.jaillet@wanadoo.fr> wrote:
> If 'of_property_read_string' fails, then 'soc_dev_attr' should be freed,
> otherwise, there is a memory leak.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] soc: versatile: Add missing kfree in error path
@ 2015-07-17 19:51 ` Linus Walleij
0 siblings, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2015-07-17 19:51 UTC (permalink / raw)
To: Christophe JAILLET; +Cc: Arnd Bergmann, linux-kernel, kernel-janitors
On Fri, Jul 17, 2015 at 7:54 PM, Christophe JAILLET
<christophe.jaillet@wanadoo.fr> wrote:
> If 'of_property_read_string' fails, then 'soc_dev_attr' should be freed,
> otherwise, there is a memory leak.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-07-17 19:51 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-17 17:54 [PATCH] soc: versatile: Add missing kfree in error path Christophe JAILLET
2015-07-17 17:54 ` Christophe JAILLET
2015-07-17 19:51 ` Linus Walleij
2015-07-17 19:51 ` Linus Walleij
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.