[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CABVgOSkbqRtUTmL83HU6Nf0kp9KmrL6ZpRL2F3VDtSDEQq1DCA@mail.gmail.com>
Date: Fri, 21 Oct 2022 15:37:59 +0800
From: David Gow <davidgow@...gle.com>
To: Javier Martinez Canillas <javierm@...hat.com>
Cc: José Expósito <jose.exposito89@...il.com>,
David Airlie <airlied@...il.com>,
Daniel Vetter <daniel@...ll.ch>,
Thomas Zimmermann <tzimmermann@...e.de>,
Maxime Ripard <maxime@...no.tech>,
Naresh Kamboju <naresh.kamboju@...aro.org>,
Maíra Canal <mairacanal@...eup.net>,
dri-devel@...ts.freedesktop.org, Sam Ravnborg <sam@...nborg.org>,
linux-kernel@...r.kernel.org, kunit-dev@...glegroups.com,
Linux Kernel Functional Testing <lkft@...aro.org>
Subject: Re: [PATCH] drm: tests: Fix a buffer overflow in format_helper_test
On Thu, Oct 20, 2022 at 4:03 PM Javier Martinez Canillas
<javierm@...hat.com> wrote:
>
> On 10/19/22 19:29, José Expósito wrote:
>
> [...]
>
> >> drivers/gpu/drm/tests/drm_format_helper_test.c | 2 +-
> >> 1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/gpu/drm/tests/drm_format_helper_test.c b/drivers/gpu/drm/tests/drm_format_helper_test.c
> >> index 8d86c250c2ec..2191e57f2297 100644
> >> --- a/drivers/gpu/drm/tests/drm_format_helper_test.c
> >> +++ b/drivers/gpu/drm/tests/drm_format_helper_test.c
> >> @@ -438,7 +438,7 @@ static void drm_test_fb_xrgb8888_to_xrgb2101010(struct kunit *test)
> >> iosys_map_set_vaddr(&src, xrgb8888);
> >>
> >> drm_fb_xrgb8888_to_xrgb2101010(&dst, &result->dst_pitch, &src, &fb, ¶ms->clip);
> >> - buf = le32buf_to_cpu(test, buf, TEST_BUF_SIZE);
> >> + buf = le32buf_to_cpu(test, buf, dst_size / sizeof(u32));
> >> KUNIT_EXPECT_EQ(test, memcmp(buf, result->expected, dst_size), 0);
> >> }
> >
> > Thanks a lot for fixing this bug David, I just tested it and
> > worked as expected.
> >
>
> I've pushed this to drm-misc (drm-misc-fixes) now. Thanks!
>
Thanks very much!
> > Do you think that we should update the other calls to
> > le32buf_to_cpu() to follow a similar approach?
> >
>
> Feel free to post follow-up patches if you think that other changes are needed.
>
I _think_ this should be the only actually necessary change. Maybe
there's some cleanup of the way TEST_BUF_SIZE is used, or the sparse
annotations for endianness, but I'd need to look into exactly what the
various drm_format definitions are in more detail to know for sure.
Cheers,
-- David
Download attachment "smime.p7s" of type "application/pkcs7-signature" (4003 bytes)
Powered by blists - more mailing lists