From: Lee Jones <lee.jones@linaro.org>
To: christian.koenig@amd.com
Cc: Alex Deucher <alexander.deucher@amd.com>,
Jinzhou Su <Jinzhou.Su@amd.com>, Huang Rui <ray.huang@amd.com>,
changfeng.zhu@amd.com, amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/amd/display: fix the system memory page fault because of copy overflow
Date: Fri, 15 Jan 2021 13:44:10 +0000 [thread overview]
Message-ID: <20210115134410.GL3975472@dell> (raw)
In-Reply-To: <1c67eae5-a77c-b6af-4f80-94b5b80733eb@gmail.com>
On Fri, 15 Jan 2021, Christian König wrote:
> Am 15.01.21 um 19:46 schrieb Huang Rui:
> > The buffer is allocated with the size of pointer and copy with the size of
> > data structure. Then trigger the system memory page fault. Use the
> > orignal data structure to get the object size.
> >
> > Fixes: a8e30005b drm/amd/display/dc/core/dc_link: Move some local data
> > from the stack to the heap
> >
> > Signed-off-by: Huang Rui <ray.huang@amd.com>
> > Cc: Lee Jones <lee.jones@linaro.org>
> > ---
> > drivers/gpu/drm/amd/display/dc/core/dc_link.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link.c b/drivers/gpu/drm/amd/display/dc/core/dc_link.c
> > index 69573d67056d..73178978ae74 100644
> > --- a/drivers/gpu/drm/amd/display/dc/core/dc_link.c
> > +++ b/drivers/gpu/drm/amd/display/dc/core/dc_link.c
> > @@ -1380,7 +1380,7 @@ static bool dc_link_construct(struct dc_link *link,
> > DC_LOGGER_INIT(dc_ctx->logger);
> > - info = kzalloc(sizeof(info), GFP_KERNEL);
> > + info = kzalloc(sizeof(struct integrated_info), GFP_KERNEL);
>
> That should probably be sizeof(*info) instead, we usually try to avoid
> sizeof(struct ...) in the kernel.
>
> There are some automated scripts in place which will send you a patch to
> change it otherwise.
>
> > if (!info)
> > goto create_fail;
> > @@ -1545,7 +1545,7 @@ static bool dc_link_construct(struct dc_link *link,
> > }
> > if (bios->integrated_info)
> > - memcpy(info, bios->integrated_info, sizeof(*info));
> > + memcpy(info, bios->integrated_info, sizeof(struct integrated_info));
>
> This can then also stay as it is.
>
> Apart from that good catch.
Yes, agreed.
Sorry for the fuss.
--
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
next prev parent reply other threads:[~2021-01-15 15:08 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-15 18:46 [PATCH] drm/amd/display: fix the system memory page fault because of copy overflow Huang Rui
2021-01-15 10:49 ` Su, Jinzhou (Joe)
2021-01-15 11:21 ` Lee Jones
2021-01-15 11:22 ` Christian König
2021-01-15 13:44 ` Lee Jones [this message]
2021-01-15 21:35 ` Huang Rui
2021-01-15 11:26 ` Chen, Jiansong (Simon)
2021-01-15 21:38 ` Huang Rui
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=20210115134410.GL3975472@dell \
--to=lee.jones@linaro.org \
--cc=Jinzhou.Su@amd.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=changfeng.zhu@amd.com \
--cc=christian.koenig@amd.com \
--cc=ray.huang@amd.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.