All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Yacoub <markyacoub@chromium.org>
To: Abhinav Kumar <quic_abhinavk@quicinc.com>
Cc: petri.latvala@intel.com, quic_khsieh@quicinc.com,
	swboyd@chromium.org, igt-dev@lists.freedesktop.org,
	nganji@codeaurora.org, seanpaul@chromium.org,
	aravindh@codeaurora.org
Subject: Re: [igt-dev] [PATCH i-g-t] lib/igt_fb: fix the plane_size array for yuv formats
Date: Wed, 1 Dec 2021 10:35:58 -0500	[thread overview]
Message-ID: <CAJUqKUoPaXFjuS-niZ0ZE1JHyNffAy-yQexDDXH1kpnGLuPAnA@mail.gmail.com> (raw)
In-Reply-To: <1638219625-19543-1-git-send-email-quic_abhinavk@quicinc.com>

On Mon, Nov 29, 2021 at 4:00 PM Abhinav Kumar <quic_abhinavk@quicinc.com> wrote:
>
> clear_yuv_buffer() checks the size of the plane_size[] to
> make sure its greater than the number of planes to avoid
> overflows.
>
> The plane_size[] is fixed to two currently.
>
> However some of the formats like YV12 indeed have more than
> 2 planes in the format_desc[] hence this incorrectly failing
> this check.
>
> Increase the size of the plane_size[] to match the correct
> max number of planes.
>
> Signed-off-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
> ---
>  lib/igt_fb.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/igt_fb.c b/lib/igt_fb.c
> index 92a0170..e42302d 100644
> --- a/lib/igt_fb.c
> +++ b/lib/igt_fb.c
> @@ -1007,7 +1007,7 @@ static void memset64(uint64_t *s, uint64_t c, size_t n)
>  static void clear_yuv_buffer(struct igt_fb *fb)
>  {
>         bool full_range = fb->color_range == IGT_COLOR_YCBCR_FULL_RANGE;
> -       size_t plane_size[2];
> +       size_t plane_size[3];
I haven't looked closely at this code before but i took a look now and
2 things come to mind:

1. can we use lookup_drm_format(fb->drm_format)->num_planes for the
size of the plane_size array, this way it's expandable as needed (we
would need to add asserts to check for size at each switch-case.
2. Starting Line 1029, we clear up the memory up to 2 planes. if we
would use 3 planes, where are we using the 3rd one to clear up the
memory as well?

>         void *ptr;
>
>         igt_assert(igt_format_is_yuv(fb->drm_format));
> --
> 2.7.4
>

      parent reply	other threads:[~2021-12-01 15:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-29 21:00 [igt-dev] [PATCH i-g-t] lib/igt_fb: fix the plane_size array for yuv formats Abhinav Kumar
2021-11-29 22:44 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2021-11-30  1:01 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2021-12-01 15:35 ` Mark Yacoub [this message]

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=CAJUqKUoPaXFjuS-niZ0ZE1JHyNffAy-yQexDDXH1kpnGLuPAnA@mail.gmail.com \
    --to=markyacoub@chromium.org \
    --cc=aravindh@codeaurora.org \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=nganji@codeaurora.org \
    --cc=petri.latvala@intel.com \
    --cc=quic_abhinavk@quicinc.com \
    --cc=quic_khsieh@quicinc.com \
    --cc=seanpaul@chromium.org \
    --cc=swboyd@chromium.org \
    /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.