Re: [PATCH 1/2] drm/edid: Don't look for CEA data blocks in CEA ext block rev < 3

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Ville,

On Mon,  2 Sep 2019 16:15:45 +0300, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>
> 
> CEA ext block revisions 1 and 2 do not contain the data block
> collection. Instead that section of the extension block is
> marked as reserved for 8 byte timing descriptors. Revision 3
> changed it to contain the CEA data block collection instead.
> 
> Most places that iterate the data blocks already check for
> revision >= 3, but drm_detect_hdmi_monitor() and
> drm_detect_monitor_audio() do not. So in theory when encountering
> rev 1 or 2 CEA extension block they could end up misinterpreting
> whatever data is in the reserved section as CEA data blocks.
> 
> Let's have cea_db_offsets() do the revision check so that the
> callers don't even have worry about it.
> 
> Cc: Jean Delvare <jdelvare@xxxxxxx>
> Signed-off-by: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>
> ---
>  drivers/gpu/drm/drm_edid.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> index 82a4ceed3fcf..7b3072fc550b 100644
> --- a/drivers/gpu/drm/drm_edid.c
> +++ b/drivers/gpu/drm/drm_edid.c
> @@ -3690,6 +3690,9 @@ cea_revision(const u8 *cea)
>  static int
>  cea_db_offsets(const u8 *cea, int *start, int *end)
>  {
> +	if (cea_revision(cea) < 3)
> +		return -ENOTSUPP;
> +
>  	/* DisplayID CTA extension blocks and top-level CEA EDID
>  	 * block header definitions differ in the following bytes:
>  	 *   1) Byte 2 of the header specifies length differently,

Reviewed-by: Jean Delvare <jdelvare@xxxxxxx>

I like it, but then we need a subsequent patch to remove the now
redundant checks in add_cea_modes(), drm_edid_to_eld(),
drm_edid_to_sad() and drm_edid_to_speaker_allocation().

These last 2 functions are the ones my own patch modifies, so some care
is needed. If cea_db_offsets() now returns an error when CEA revisions
< 3, then these functions want to return 0 in that case (otherwise you
effectively undo the change I proposed).

By the way,  both functions issue a debug message "SAD: invalid data
block offsets" when cea_db_offsets() returns an error, which becomes
misleading after your change. I think we want to move this message
inside cea_db_offsets() and only print it in the -ERANGE case.

-- 
Jean Delvare
SUSE L3 Support
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux