linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* re: OMAPDSS: remove dispc's dependency to VENC/HDMI
@ 2013-08-27  1:20 Dan Carpenter
  2013-08-27 11:16 ` Tomi Valkeinen
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2013-08-27  1:20 UTC (permalink / raw)
  To: tomi.valkeinen; +Cc: linux-omap

Hello Tomi Valkeinen,

This is a semi-automatic email about new static checker warnings.

The patch 5391e87d1259: "OMAPDSS: remove dispc's dependency to 
VENC/HDMI" from May 16, 2013, leads to the following Smatch complaint:

drivers/video/omap2/dss/hdmi.c:672 omapdss_hdmi_display_set_timing()
	 error: we previously assumed 't' could be null (see line 669)

drivers/video/omap2/dss/hdmi.c
   668		t = hdmi_get_timings();
   669		if (t != NULL)
                    ^^^^^^^^^
Existing check.

   670			hdmi.ip_data.cfg = *t;
   671	
   672		dispc_set_tv_pclk(t->timings.pixel_clock * 1000);
                                  ^^^^^^^^^^^^^^^^^^^^^^
Patch added a dereference.

   673	
   674		mutex_unlock(&hdmi.lock);

regards,
dan carpenter

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

* Re: OMAPDSS: remove dispc's dependency to VENC/HDMI
  2013-08-27  1:20 OMAPDSS: remove dispc's dependency to VENC/HDMI Dan Carpenter
@ 2013-08-27 11:16 ` Tomi Valkeinen
  0 siblings, 0 replies; 2+ messages in thread
From: Tomi Valkeinen @ 2013-08-27 11:16 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: linux-omap

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

Hi,

On 27/08/13 04:20, Dan Carpenter wrote:
> Hello Tomi Valkeinen,
> 
> This is a semi-automatic email about new static checker warnings.
> 
> The patch 5391e87d1259: "OMAPDSS: remove dispc's dependency to 
> VENC/HDMI" from May 16, 2013, leads to the following Smatch complaint:
> 
> drivers/video/omap2/dss/hdmi.c:672 omapdss_hdmi_display_set_timing()
> 	 error: we previously assumed 't' could be null (see line 669)
> 
> drivers/video/omap2/dss/hdmi.c
>    668		t = hdmi_get_timings();
>    669		if (t != NULL)
>                     ^^^^^^^^^
> Existing check.
> 
>    670			hdmi.ip_data.cfg = *t;
>    671	
>    672		dispc_set_tv_pclk(t->timings.pixel_clock * 1000);
>                                   ^^^^^^^^^^^^^^^^^^^^^^
> Patch added a dereference.
> 
>    673	
>    674		mutex_unlock(&hdmi.lock);
> 

Thanks. I've made a fix, below.

 Tomi

commit 70218db3effca57252625042a2b2c740fd3604ba (HEAD, work/fixes)
Author: Tomi Valkeinen <tomi.valkeinen@ti.com>
Date:   Tue Aug 27 14:11:48 2013 +0300

    OMAPDSS: HDMI: Fix possible NULL reference
    
    Commit 5391e87d1259 (OMAPDSS: remove dispc's dependency to VENC/HDMI)
    introduced a possible NULL reference bug in the HDMI driver when setting
    timings. In practice the bug shouldn't happen, as the timings have been
    verified earlier, and thus the timings should always be ok.
    
    Fix the possible issue by moving the use of the timings pointer inside
    the NULL check.
    
    Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index 44a885b..ea97854 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -666,10 +666,11 @@ void omapdss_hdmi_display_set_timing(struct omap_dss_device *dssdev,
 	hdmi.ip_data.cfg.cm = cm;
 
 	t = hdmi_get_timings();
-	if (t != NULL)
+	if (t != NULL) {
 		hdmi.ip_data.cfg = *t;
 
-	dispc_set_tv_pclk(t->timings.pixel_clock * 1000);
+		dispc_set_tv_pclk(t->timings.pixel_clock * 1000);
+	}
 
 	mutex_unlock(&hdmi.lock);
 }



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

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

end of thread, other threads:[~2013-08-27 11:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-27  1:20 OMAPDSS: remove dispc's dependency to VENC/HDMI Dan Carpenter
2013-08-27 11:16 ` Tomi Valkeinen

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).