From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Jani Nikula <jani.nikula@intel.com>
Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH v2 7/8] drm/displayid: allow data blocks with 0 payload length
Date: Mon, 29 Mar 2021 22:36:58 +0300 [thread overview]
Message-ID: <YGIsWg0WccD4mzbi@intel.com> (raw)
In-Reply-To: <d562dff99ba7c92accb654a99b433bed471e8507.1617024940.git.jani.nikula@intel.com>
On Mon, Mar 29, 2021 at 04:37:21PM +0300, Jani Nikula wrote:
> The DisplayID specifications explicitly call out 0 as a valid payload
> length for data blocks. The mere presence of a data block, or the
> information coded in the block specific data (bits 7:3 in offset 1), may
> be enough to convey the necessary information.
>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Though after looking at the current users it looks to me like
we're missing some block length checks. In particular
drm_parse_tiled_block() looks suspect. Judging by what I wrote
in cea_db_offsets() I think I once convinced myself that the
CEA ext block stuff is safe. And add_displayid_detailed_1_modes()
looks OK as well.
> ---
> drivers/gpu/drm/drm_displayid.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_displayid.c b/drivers/gpu/drm/drm_displayid.c
> index 902ff6114b68..e0b9e58a9dc8 100644
> --- a/drivers/gpu/drm/drm_displayid.c
> +++ b/drivers/gpu/drm/drm_displayid.c
> @@ -77,8 +77,7 @@ displayid_iter_block(const struct displayid_iter *iter)
> block = (const struct displayid_block *)&iter->section[iter->idx];
>
> if (iter->idx + sizeof(*block) <= iter->length &&
> - iter->idx + sizeof(*block) + block->num_bytes <= iter->length &&
> - block->num_bytes > 0)
> + iter->idx + sizeof(*block) + block->num_bytes <= iter->length)
> return block;
>
> return NULL;
> --
> 2.20.1
--
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
WARNING: multiple messages have this Message-ID (diff)
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Jani Nikula <jani.nikula@intel.com>
Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v2 7/8] drm/displayid: allow data blocks with 0 payload length
Date: Mon, 29 Mar 2021 22:36:58 +0300 [thread overview]
Message-ID: <YGIsWg0WccD4mzbi@intel.com> (raw)
In-Reply-To: <d562dff99ba7c92accb654a99b433bed471e8507.1617024940.git.jani.nikula@intel.com>
On Mon, Mar 29, 2021 at 04:37:21PM +0300, Jani Nikula wrote:
> The DisplayID specifications explicitly call out 0 as a valid payload
> length for data blocks. The mere presence of a data block, or the
> information coded in the block specific data (bits 7:3 in offset 1), may
> be enough to convey the necessary information.
>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Though after looking at the current users it looks to me like
we're missing some block length checks. In particular
drm_parse_tiled_block() looks suspect. Judging by what I wrote
in cea_db_offsets() I think I once convinced myself that the
CEA ext block stuff is safe. And add_displayid_detailed_1_modes()
looks OK as well.
> ---
> drivers/gpu/drm/drm_displayid.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_displayid.c b/drivers/gpu/drm/drm_displayid.c
> index 902ff6114b68..e0b9e58a9dc8 100644
> --- a/drivers/gpu/drm/drm_displayid.c
> +++ b/drivers/gpu/drm/drm_displayid.c
> @@ -77,8 +77,7 @@ displayid_iter_block(const struct displayid_iter *iter)
> block = (const struct displayid_block *)&iter->section[iter->idx];
>
> if (iter->idx + sizeof(*block) <= iter->length &&
> - iter->idx + sizeof(*block) + block->num_bytes <= iter->length &&
> - block->num_bytes > 0)
> + iter->idx + sizeof(*block) + block->num_bytes <= iter->length)
> return block;
>
> return NULL;
> --
> 2.20.1
--
Ville Syrjälä
Intel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2021-03-29 19:37 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-29 13:37 [Intel-gfx] [PATCH v2 0/8] drm/edid: overhaul displayid iterator Jani Nikula
2021-03-29 13:37 ` Jani Nikula
2021-03-29 13:37 ` [Intel-gfx] [PATCH v2 1/8] drm/edid: make a number of functions, parameters and variables const Jani Nikula
2021-03-29 13:37 ` Jani Nikula
2021-03-29 13:37 ` [Intel-gfx] [PATCH v2 2/8] drm/displayid: add separate drm_displayid.c Jani Nikula
2021-03-29 13:37 ` Jani Nikula
2021-03-29 13:37 ` [Intel-gfx] [PATCH v2 3/8] drm/displayid: add new displayid section/block iterators Jani Nikula
2021-03-29 13:37 ` Jani Nikula
2021-03-29 13:37 ` [Intel-gfx] [PATCH v2 4/8] drm/edid: use the new displayid iterator for detailed modes Jani Nikula
2021-03-29 13:37 ` Jani Nikula
2021-03-29 13:37 ` [Intel-gfx] [PATCH v2 5/8] drm/edid: use the new displayid iterator for finding CEA extension Jani Nikula
2021-03-29 13:37 ` Jani Nikula
2021-03-29 13:37 ` [Intel-gfx] [PATCH v2 6/8] drm/edid: use the new displayid iterator for tile info Jani Nikula
2021-03-29 13:37 ` Jani Nikula
2021-03-29 13:37 ` [Intel-gfx] [PATCH v2 7/8] drm/displayid: allow data blocks with 0 payload length Jani Nikula
2021-03-29 13:37 ` Jani Nikula
2021-03-29 19:36 ` Ville Syrjälä [this message]
2021-03-29 19:36 ` Ville Syrjälä
2021-03-29 13:37 ` [Intel-gfx] [PATCH v2 8/8] drm/displayid: rename displayid_hdr to displayid_header Jani Nikula
2021-03-29 13:37 ` Jani Nikula
2021-03-29 19:37 ` [Intel-gfx] " Ville Syrjälä
2021-03-29 19:37 ` Ville Syrjälä
2021-03-29 14:04 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/edid: overhaul displayid iterator (rev3) Patchwork
2021-03-29 14:06 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2021-03-29 14:10 ` [Intel-gfx] ✗ Fi.CI.DOCS: " Patchwork
2021-03-29 14:33 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2021-03-29 16:42 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork
2021-03-31 16:23 ` [Intel-gfx] [PATCH v2 0/8] drm/edid: overhaul displayid iterator Jani Nikula
2021-03-31 16:23 ` Jani Nikula
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YGIsWg0WccD4mzbi@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jani.nikula@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.