[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CADnq5_NA+vck4=zq8LxkrJDx0AXcu8iLAs=TNdvxoWhFqeTfEA@mail.gmail.com>
Date: Thu, 8 Oct 2020 13:22:51 -0400
From: Alex Deucher <alexdeucher@...il.com>
To: "Gustavo A. R. Silva" <gustavoars@...nel.org>
Cc: Felix Kuehling <Felix.Kuehling@....com>,
Alex Deucher <alexander.deucher@....com>,
Christian König <christian.koenig@....com>,
David Airlie <airlied@...ux.ie>,
Daniel Vetter <daniel@...ll.ch>,
linux-hardening@...r.kernel.org,
Maling list - DRI developers
<dri-devel@...ts.freedesktop.org>,
amd-gfx list <amd-gfx@...ts.freedesktop.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH][next] drm/amdgpu: Use struct_size() helper in kmalloc()
Applied. Thanks!
Alex
On Thu, Oct 8, 2020 at 10:17 AM Gustavo A. R. Silva
<gustavoars@...nel.org> wrote:
>
> Make use of the new struct_size() helper instead of the offsetof() idiom.
>
> Signed-off-by: Gustavo A. R. Silva <gustavoars@...nel.org>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
> index 5da487b64a66..30192dce7775 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
> @@ -239,8 +239,7 @@ static int amdgpu_amdkfd_remove_eviction_fence(struct amdgpu_bo *bo,
> if (!old)
> return 0;
>
> - new = kmalloc(offsetof(typeof(*new), shared[old->shared_max]),
> - GFP_KERNEL);
> + new = kmalloc(struct_size(new, shared, old->shared_max), GFP_KERNEL);
> if (!new)
> return -ENOMEM;
>
> --
> 2.27.0
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@...ts.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
Powered by blists - more mailing lists