Message ID | 20240327044422.240398-4-suraj.kandpal@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Fix UBSAN warning in hdcp_info | expand |
Hello, > -----Original Message----- > From: Kandpal, Suraj <suraj.kandpal@intel.com> > Sent: Wednesday, March 27, 2024 10:14 AM > To: intel-gfx@lists.freedesktop.org > Cc: Borah, Chaitanya Kumar <chaitanya.kumar.borah@intel.com>; Kandpal, > Suraj <suraj.kandpal@intel.com> > Subject: [PATCH 2/2] drm/i915/hdcp: Fix get remote hdcp capability function > > HDCP 1.x capability needs to be checked even if setup is not HDCP 2.x capable. > > Fixes: 813cca96e4ac ("drm/i915/hdcp: Add new remote capability check shim > function") > Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com> > --- > drivers/gpu/drm/i915/display/intel_dp_hdcp.c | 9 ++++----- > 1 file changed, 4 insertions(+), 5 deletions(-) > > diff --git a/drivers/gpu/drm/i915/display/intel_dp_hdcp.c > b/drivers/gpu/drm/i915/display/intel_dp_hdcp.c > index b98a87883fef..7f52043b0f9f 100644 > --- a/drivers/gpu/drm/i915/display/intel_dp_hdcp.c > +++ b/drivers/gpu/drm/i915/display/intel_dp_hdcp.c > @@ -688,7 +688,7 @@ int intel_dp_hdcp_get_remote_capability(struct > intel_connector *connector, { > struct drm_i915_private *i915 = to_i915(connector->base.dev); > struct drm_dp_aux *aux = &connector->port->aux; > - u8 bcaps; > + u8 bcaps = 0; > int ret; > > if (!intel_encoder_is_mst(connector->encoder)) > @@ -696,15 +696,14 @@ int intel_dp_hdcp_get_remote_capability(struct > intel_connector *connector, > > ret = _intel_dp_hdcp2_get_capability(aux, hdcp2_capable); > if (ret) > - return ret; > + drm_dbg_kms(&i915->drm, > + "HDCP2 DPCD capability read failed err: %d\n", ret); > > ret = intel_dp_hdcp_read_bcaps(aux, i915, &bcaps); > - if (ret) > - return ret; > > *hdcp_capable = bcaps & DP_BCAPS_HDCP_CAPABLE; > Let's keep the behavior same for both hdcp_capable and hdcp2_capable in case of failure. Either assign both of them as false, or not assign anything. Regards Chaitanya > - return 0; > + return ret; > } > > static const struct intel_hdcp_shim intel_dp_hdcp_shim = { > -- > 2.43.2
> -----Original Message----- > From: Borah, Chaitanya Kumar > Sent: Thursday, March 28, 2024 3:56 PM > To: Kandpal, Suraj <suraj.kandpal@intel.com>; intel-gfx@lists.freedesktop.org > Subject: RE: [PATCH 2/2] drm/i915/hdcp: Fix get remote hdcp capability > function > > Hello, > > > -----Original Message----- > > From: Kandpal, Suraj <suraj.kandpal@intel.com> > > Sent: Wednesday, March 27, 2024 10:14 AM > > To: intel-gfx@lists.freedesktop.org > > Cc: Borah, Chaitanya Kumar <chaitanya.kumar.borah@intel.com>; Kandpal, > > Suraj <suraj.kandpal@intel.com> > > Subject: [PATCH 2/2] drm/i915/hdcp: Fix get remote hdcp capability > > function > > > > HDCP 1.x capability needs to be checked even if setup is not HDCP 2.x > capable. > > > > Fixes: 813cca96e4ac ("drm/i915/hdcp: Add new remote capability check > > shim > > function") > > Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com> > > --- > > drivers/gpu/drm/i915/display/intel_dp_hdcp.c | 9 ++++----- > > 1 file changed, 4 insertions(+), 5 deletions(-) > > > > diff --git a/drivers/gpu/drm/i915/display/intel_dp_hdcp.c > > b/drivers/gpu/drm/i915/display/intel_dp_hdcp.c > > index b98a87883fef..7f52043b0f9f 100644 > > --- a/drivers/gpu/drm/i915/display/intel_dp_hdcp.c > > +++ b/drivers/gpu/drm/i915/display/intel_dp_hdcp.c > > @@ -688,7 +688,7 @@ int intel_dp_hdcp_get_remote_capability(struct > > intel_connector *connector, { > > struct drm_i915_private *i915 = to_i915(connector->base.dev); > > struct drm_dp_aux *aux = &connector->port->aux; > > - u8 bcaps; > > + u8 bcaps = 0; > > int ret; > > > > if (!intel_encoder_is_mst(connector->encoder)) > > @@ -696,15 +696,14 @@ int intel_dp_hdcp_get_remote_capability(struct > > intel_connector *connector, > > > > ret = _intel_dp_hdcp2_get_capability(aux, hdcp2_capable); > > if (ret) > > - return ret; > > + drm_dbg_kms(&i915->drm, > > + "HDCP2 DPCD capability read failed err: %d\n", ret); > > > > ret = intel_dp_hdcp_read_bcaps(aux, i915, &bcaps); > > - if (ret) > > - return ret; > > > > *hdcp_capable = bcaps & DP_BCAPS_HDCP_CAPABLE; > > > > Let's keep the behavior same for both hdcp_capable and hdcp2_capable in > case of failure. > > Either assign both of them as false, or not assign anything. > IMO, assigning them false could be a better approach if you don't see any harm in it. It is not great to be dependent on the semantics of them being initialized first. > Regards > > Chaitanya > > > > > - return 0; > > + return ret; > > } > > > > static const struct intel_hdcp_shim intel_dp_hdcp_shim = { > > -- > > 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 b98a87883fef..7f52043b0f9f 100644 --- a/drivers/gpu/drm/i915/display/intel_dp_hdcp.c +++ b/drivers/gpu/drm/i915/display/intel_dp_hdcp.c @@ -688,7 +688,7 @@ int intel_dp_hdcp_get_remote_capability(struct intel_connector *connector, { struct drm_i915_private *i915 = to_i915(connector->base.dev); struct drm_dp_aux *aux = &connector->port->aux; - u8 bcaps; + u8 bcaps = 0; int ret; if (!intel_encoder_is_mst(connector->encoder)) @@ -696,15 +696,14 @@ int intel_dp_hdcp_get_remote_capability(struct intel_connector *connector, ret = _intel_dp_hdcp2_get_capability(aux, hdcp2_capable); if (ret) - return ret; + drm_dbg_kms(&i915->drm, + "HDCP2 DPCD capability read failed err: %d\n", ret); ret = intel_dp_hdcp_read_bcaps(aux, i915, &bcaps); - if (ret) - return ret; *hdcp_capable = bcaps & DP_BCAPS_HDCP_CAPABLE; - return 0; + return ret; } static const struct intel_hdcp_shim intel_dp_hdcp_shim = {
HDCP 1.x capability needs to be checked even if setup is not HDCP 2.x capable. Fixes: 813cca96e4ac ("drm/i915/hdcp: Add new remote capability check shim function") Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com> --- drivers/gpu/drm/i915/display/intel_dp_hdcp.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)