Message ID | 20240722064451.3610512-3-suraj.kandpal@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Fix null pointer error in HDCP capability check | expand |
> -----Original Message----- > From: Intel-gfx <intel-gfx-bounces@lists.freedesktop.org> On Behalf Of Suraj > Kandpal > Sent: Monday, July 22, 2024 12:15 PM > To: intel-gfx@lists.freedesktop.org; intel-xe@lists.freedesktop.org > Cc: Nautiyal, Ankit K <ankit.k.nautiyal@intel.com>; Kandpal, Suraj > <suraj.kandpal@intel.com> > Subject: [PATCH 2/3] drm/i915/hdcp: Add encoder check in > hdcp2_get_capability > > Add encoder check in intel_hdcp2_get_capability to avoid null pointer error. > > Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com> LGTM. Thanks. Reviewed-by: Dnyaneshwar Bhadane <dnyaneshwar.bhadane@intel.com> > --- > drivers/gpu/drm/i915/display/intel_dp_hdcp.c | 11 +++++++++-- > 1 file changed, 9 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/i915/display/intel_dp_hdcp.c > b/drivers/gpu/drm/i915/display/intel_dp_hdcp.c > index 2edffe62f360..47f51a5ab493 100644 > --- a/drivers/gpu/drm/i915/display/intel_dp_hdcp.c > +++ b/drivers/gpu/drm/i915/display/intel_dp_hdcp.c > @@ -675,8 +675,15 @@ static > int intel_dp_hdcp2_get_capability(struct intel_connector *connector, > bool *capable) > { > - struct intel_digital_port *dig_port = > intel_attached_dig_port(connector); > - struct drm_dp_aux *aux = &dig_port->dp.aux; > + struct intel_digital_port *dig_port; > + struct drm_dp_aux *aux; > + > + *capable = false; > + if (!intel_attached_encoder(connector)) > + return -EINVAL; > + > + dig_port = intel_attached_dig_port(connector); > + aux = &dig_port->dp.aux; > > return _intel_dp_hdcp2_get_capability(aux, capable); } > -- > 2.43.2
diff --git a/drivers/gpu/drm/i915/display/intel_dp_hdcp.c b/drivers/gpu/drm/i915/display/intel_dp_hdcp.c index 2edffe62f360..47f51a5ab493 100644 --- a/drivers/gpu/drm/i915/display/intel_dp_hdcp.c +++ b/drivers/gpu/drm/i915/display/intel_dp_hdcp.c @@ -675,8 +675,15 @@ static int intel_dp_hdcp2_get_capability(struct intel_connector *connector, bool *capable) { - struct intel_digital_port *dig_port = intel_attached_dig_port(connector); - struct drm_dp_aux *aux = &dig_port->dp.aux; + struct intel_digital_port *dig_port; + struct drm_dp_aux *aux; + + *capable = false; + if (!intel_attached_encoder(connector)) + return -EINVAL; + + dig_port = intel_attached_dig_port(connector); + aux = &dig_port->dp.aux; return _intel_dp_hdcp2_get_capability(aux, capable); }
Add encoder check in intel_hdcp2_get_capability to avoid null pointer error. Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com> --- drivers/gpu/drm/i915/display/intel_dp_hdcp.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)