From 6e8a942b9ddc9b6b122e58a604bc3b452d2b8e8a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ville=20Syrj=C3=A4l=C3=A4?= Date: Fri, 24 Jan 2020 22:02:28 +0200 Subject: [PATCH] drm/edid: Document why we don't bounds check the DispID CEA block start/end MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit After much head scratching I managed to convince myself that for_each_displayid_db() has already done the bounds checks for the DispID CEA data block. Which is why we don't need to repeat them in cea_db_offsets(). To avoid having to go through that pain again in the future add a comment which explains this fact. Cc: Andres Rodriguez Signed-off-by: Ville Syrjälä Link: https://patchwork.freedesktop.org/patch/msgid/20200124200231.10517-5-ville.syrjala@linux.intel.com Acked-by: Alex Deucher Reviewed-by: Uma Shankar --- drivers/gpu/drm/drm_edid.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 8ba53472509d..61f77377b49f 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -4017,6 +4017,10 @@ cea_db_offsets(const u8 *cea, int *start, int *end) * no non-DTD data. */ if (cea[0] == DATA_BLOCK_CTA) { + /* + * for_each_displayid_db() has already verified + * that these stay within expected bounds. + */ *start = 3; *end = *start + cea[2]; } else if (cea[0] == CEA_EXT) { -- 2.11.0