linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tomi Valkeinen <tomi.valkeinen@ti.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: linux-omap@vger.kernel.org
Subject: Re: OMAPDSS: remove dispc's dependency to VENC/HDMI
Date: Tue, 27 Aug 2013 14:16:22 +0300	[thread overview]
Message-ID: <521C8A86.8020306@ti.com> (raw)
In-Reply-To: <20130827012016.GE17061@elgon.mountain>

[-- 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 --]

      reply	other threads:[~2013-08-27 11:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-27  1:20 OMAPDSS: remove dispc's dependency to VENC/HDMI Dan Carpenter
2013-08-27 11:16 ` Tomi Valkeinen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=521C8A86.8020306@ti.com \
    --to=tomi.valkeinen@ti.com \
    --cc=dan.carpenter@oracle.com \
    --cc=linux-omap@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).