OMAPDSS: remove dispc's dependency to VENC/HDMI
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
Hi,
Quoted 16 lines · Dan Carpenter
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:672omapdss_hdmi_display_set_timing()
error: we previously assumed 't' could be null (see line 669)
drivers/video/omap2/dss/hdmi.c668 t = hdmi_get_timings(); 669 if (t != NULL) ^^^^^^^^^Existing check.
Quoted 9 lines
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 <[email protected]> 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.
drivers/video/omap2/dss/hdmi.c +3 -2
@@ -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); }