linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] video: Fix possible leak in of_get_videomode()
@ 2015-07-11 17:46 Christian Engelmayer
  0 siblings, 0 replies; 2+ messages in thread
From: Christian Engelmayer @ 2015-07-11 17:46 UTC (permalink / raw)
  To: linux-fbdev

In case videomode_from_timings() fails in function of_get_videomode(), the
allocated display timing data is not freed in the exit path. Make sure that
display_timings_release() is called in any case. Detected by Coverity CID
1309681.

Signed-off-by: Christian Engelmayer <cengelma@gmx.at>
---
Compile tested only. Applies against linux-next.
---
 drivers/video/of_videomode.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/video/of_videomode.c b/drivers/video/of_videomode.c
index 111c2d1911d3..3495b48c6805 100644
--- a/drivers/video/of_videomode.c
+++ b/drivers/video/of_videomode.c
@@ -44,11 +44,7 @@ int of_get_videomode(struct device_node *np, struct videomode *vm,
 		index = disp->native_mode;
 
 	ret = videomode_from_timings(disp, vm, index);
-	if (ret)
-		return ret;
-
 	display_timings_release(disp);
-
-	return 0;
+	return ret;
 }
 EXPORT_SYMBOL_GPL(of_get_videomode);
-- 
1.9.1


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

* Re: [PATCH] video: Fix possible leak in of_get_videomode()
@ 2015-08-10  9:53 Tomi Valkeinen
  0 siblings, 0 replies; 2+ messages in thread
From: Tomi Valkeinen @ 2015-08-10  9:53 UTC (permalink / raw)
  To: linux-fbdev

[-- Attachment #1: Type: text/plain, Size: 1097 bytes --]



On 11/07/15 20:46, Christian Engelmayer wrote:
> In case videomode_from_timings() fails in function of_get_videomode(), the
> allocated display timing data is not freed in the exit path. Make sure that
> display_timings_release() is called in any case. Detected by Coverity CID
> 1309681.
> 
> Signed-off-by: Christian Engelmayer <cengelma@gmx.at>
> ---
> Compile tested only. Applies against linux-next.
> ---
>  drivers/video/of_videomode.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/drivers/video/of_videomode.c b/drivers/video/of_videomode.c
> index 111c2d1911d3..3495b48c6805 100644
> --- a/drivers/video/of_videomode.c
> +++ b/drivers/video/of_videomode.c
> @@ -44,11 +44,7 @@ int of_get_videomode(struct device_node *np, struct videomode *vm,
>  		index = disp->native_mode;
>  
>  	ret = videomode_from_timings(disp, vm, index);
> -	if (ret)
> -		return ret;
> -
>  	display_timings_release(disp);
> -
> -	return 0;
> +	return ret;
>  }
>  EXPORT_SYMBOL_GPL(of_get_videomode);
> 

Thanks, queued for 4.2.

 Tomi


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

end of thread, other threads:[~2015-08-10  9:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-10  9:53 [PATCH] video: Fix possible leak in of_get_videomode() Tomi Valkeinen
  -- strict thread matches above, loose matches on Subject: below --
2015-07-11 17:46 Christian Engelmayer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).