[PATCH v2 2/3] drm/amdgpu: Use kvmalloc for CS chunks【Suspected phishing email, please pay attention to password security】
Chen Li
chenli at uniontech.com
Wed Mar 3 03:14:19 UTC 2021
On Wed, 03 Mar 2021 10:23:01 +0800,
Alex Deucher wrote:
>
> On Tue, Mar 2, 2021 at 9:16 PM Chen Li <chenli at uniontech.com> wrote:
> >
> >
> > The number of chunks/chunks_array may be passed in
> > by userspace and can be large.
> >
>
> We also need to kvfree these.
Thanks for pointing out this! I will a add it in v3.
>
> Alex
>
> > Signed-off-by: Chen Li <chenli at uniontech.com>
> > ---
> > drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> > index 3e240b952e79..aefb7e68977d 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> > @@ -117,7 +117,7 @@ static int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, union drm_amdgpu_cs
> > if (cs->in.num_chunks == 0)
> > return 0;
> >
> > - chunk_array = kmalloc_array(cs->in.num_chunks, sizeof(uint64_t), GFP_KERNEL);
> > + chunk_array = kvmalloc_array(cs->in.num_chunks, sizeof(uint64_t), GFP_KERNEL);
> > if (!chunk_array)
> > return -ENOMEM;
> >
> > @@ -144,7 +144,7 @@ static int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, union drm_amdgpu_cs
> > }
> >
> > p->nchunks = cs->in.num_chunks;
> > - p->chunks = kmalloc_array(p->nchunks, sizeof(struct amdgpu_cs_chunk),
> > + p->chunks = kvmalloc_array(p->nchunks, sizeof(struct amdgpu_cs_chunk),
> > GFP_KERNEL);
> > if (!p->chunks) {
> > ret = -ENOMEM;
> > --
> > 2.30.0
> >
> >
> >
> > _______________________________________________
> > amd-gfx mailing list
> > amd-gfx at lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/amd-gfx
>
>
More information about the amd-gfx
mailing list