mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] blspec: fix erroneus free in entry_is_of_compatible()
@ 2016-09-27  5:45 Ulrich Ölmann
  2016-09-27  6:22 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Ulrich Ölmann @ 2016-09-27  5:45 UTC (permalink / raw)
  To: Barebox List

Whenever of_unflatten_dtb() encountered an error it already released the memory
before returning the error code. Make this apparent by setting the pointer to
NULL to avoid an erroneus free.

Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
---
 common/blspec.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/common/blspec.c b/common/blspec.c
index 66decb161ebd..c205d481c911 100644
--- a/common/blspec.c
+++ b/common/blspec.c
@@ -399,6 +399,7 @@ static bool entry_is_of_compatible(struct blspec_entry *entry)
 	root = of_unflatten_dtb(fdt);
 	if (IS_ERR(root)) {
 		ret = PTR_ERR(root);
+		root = NULL;
 		goto out;
 	}
 
-- 
2.9.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] blspec: fix erroneus free in entry_is_of_compatible()
  2016-09-27  5:45 [PATCH] blspec: fix erroneus free in entry_is_of_compatible() Ulrich Ölmann
@ 2016-09-27  6:22 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2016-09-27  6:22 UTC (permalink / raw)
  To: Ulrich Ölmann; +Cc: Barebox List

On Tue, Sep 27, 2016 at 07:45:24AM +0200, Ulrich Ölmann wrote:
> Whenever of_unflatten_dtb() encountered an error it already released the memory
> before returning the error code. Make this apparent by setting the pointer to
> NULL to avoid an erroneus free.
> 
> Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
> ---
>  common/blspec.c | 1 +
>  1 file changed, 1 insertion(+)

Applied, thanks

Sascha

> 
> diff --git a/common/blspec.c b/common/blspec.c
> index 66decb161ebd..c205d481c911 100644
> --- a/common/blspec.c
> +++ b/common/blspec.c
> @@ -399,6 +399,7 @@ static bool entry_is_of_compatible(struct blspec_entry *entry)
>  	root = of_unflatten_dtb(fdt);
>  	if (IS_ERR(root)) {
>  		ret = PTR_ERR(root);
> +		root = NULL;
>  		goto out;
>  	}
>  
> -- 
> 2.9.3
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-09-27  6:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-27  5:45 [PATCH] blspec: fix erroneus free in entry_is_of_compatible() Ulrich Ölmann
2016-09-27  6:22 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox