[Intel-gfx] [bug report] drm/i915/tc: Fix TypeC PHY connect/disconnect logic on ADL-P

Dan Carpenter dan.carpenter at oracle.com
Fri Oct 1 13:25:35 UTC 2021


Hello Imre Deak,

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

The patch 3e0abc7661c8: "drm/i915/tc: Fix TypeC PHY 
connect/disconnect logic on ADL-P" from Sep 29, 2021, leads to the 
following Smatch complaint:

    drivers/gpu/drm/i915/display/intel_ddi.c:4028 intel_ddi_encoder_destroy()
    warn: variable dereferenced before check 'dig_port' (see line 4020)

drivers/gpu/drm/i915/display/intel_ddi.c
  4019		struct intel_digital_port *dig_port = enc_to_dig_port(to_intel_encoder(encoder));
  4020		enum phy phy = intel_port_to_phy(i915, dig_port->base.port);
                                                       ^^^^^^^^^^^^^^^^^^^
The patch adds a new unchecked dereference.

  4021	
  4022		intel_dp_encoder_flush_work(encoder);
  4023		if (intel_phy_is_tc(i915, phy))
  4024			intel_tc_port_flush_work(dig_port);
  4025		intel_display_power_flush_work(i915);
  4026	
  4027		drm_encoder_cleanup(encoder);
  4028		if (dig_port)
                    ^^^^^^^^
But the existing code checked for NULL.

  4029			kfree(dig_port->hdcp_port_data.streams);
  4030		kfree(dig_port);

regards,
dan carpenter


More information about the Intel-gfx mailing list