lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CADnq5_OuDekGg7FspcsC1Lh-ZYEt5Vq8T046tqcJ1wRBeuL4ww@mail.gmail.com>
Date: Wed, 18 Dec 2024 09:47:47 -0500
From: Alex Deucher <alexdeucher@...il.com>
To: "Lazar, Lijo" <lijo.lazar@....com>
Cc: Mirsad Todorovac <mtodorovac69@...il.com>, Alex Deucher <alexander.deucher@....com>, 
	Victor Skvortsov <victor.skvortsov@....com>, amd-gfx@...ts.freedesktop.org, 
	dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org, 
	Christian König <christian.koenig@....com>, 
	Xinhui Pan <Xinhui.Pan@....com>, David Airlie <airlied@...il.com>, Simona Vetter <simona@...ll.ch>, 
	Zhigang Luo <Zhigang.Luo@....com>, Hawking Zhang <Hawking.Zhang@....com>, 
	Yunxiang Li <Yunxiang.Li@....com>, Jack Xiao <Jack.Xiao@....com>, 
	Vignesh Chander <Vignesh.Chander@....com>, Danijel Slivka <danijel.slivka@....com>
Subject: Re: [PATCH v1 1/3] drm/admgpu: replace kmalloc() and memcpy() with kmemdup()

Applied.  Thanks!

Alex

On Wed, Dec 18, 2024 at 3:03 AM Lazar, Lijo <lijo.lazar@....com> wrote:
>
>
>
> On 12/18/2024 4:28 AM, Mirsad Todorovac wrote:
> > The static analyser tool gave the following advice:
> >
> > ./drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c:1266:7-14: WARNING opportunity for kmemdup
> >
> >  → 1266         tmp = kmalloc(used_size, GFP_KERNEL);
> >    1267         if (!tmp)
> >    1268                 return -ENOMEM;
> >    1269
> >  → 1270         memcpy(tmp, &host_telemetry->body.error_count, used_size);
> >
> > Replacing kmalloc() + memcpy() with kmemdump() doesn't change semantics.
> > Original code works without fault, so this is not a bug fix but proposed improvement.
> >
> > Link: https://lwn.net/Articles/198928/
> > Fixes: 84a2947ecc85c ("drm/amdgpu: Implement virt req_ras_err_count")
> > Cc: Alex Deucher <alexander.deucher@....com>
> > Cc: "Christian König" <christian.koenig@....com>
> > Cc: Xinhui Pan <Xinhui.Pan@....com>
> > Cc: David Airlie <airlied@...il.com>
> > Cc: Simona Vetter <simona@...ll.ch>
> > Cc: Zhigang Luo <Zhigang.Luo@....com>
> > Cc: Victor Skvortsov <victor.skvortsov@....com>
> > Cc: Hawking Zhang <Hawking.Zhang@....com>
> > Cc: Lijo Lazar <lijo.lazar@....com>
> > Cc: Yunxiang Li <Yunxiang.Li@....com>
> > Cc: Jack Xiao <Jack.Xiao@....com>
> > Cc: Vignesh Chander <Vignesh.Chander@....com>
> > Cc: Danijel Slivka <danijel.slivka@....com>
> > Cc: amd-gfx@...ts.freedesktop.org
> > Cc: dri-devel@...ts.freedesktop.org
> > Cc: linux-kernel@...r.kernel.org
> > Signed-off-by: Mirsad Todorovac <mtodorovac69@...il.com>
>
> Reviewed-by: Lijo Lazar <lijo.lazar@....com>
>
> Thanks,
> Lijo
>
> > ---
> >  v1:
> >       initial version.
> >
> >  drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 4 +---
> >  1 file changed, 1 insertion(+), 3 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
> > index c704e9803e11..0af469ec6fcc 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
> > @@ -1263,12 +1263,10 @@ static int amdgpu_virt_cache_host_error_counts(struct amdgpu_device *adev,
> >       if (used_size > (AMD_SRIOV_RAS_TELEMETRY_SIZE_KB << 10))
> >               return 0;
> >
> > -     tmp = kmalloc(used_size, GFP_KERNEL);
> > +     tmp = kmemdup(&host_telemetry->body.error_count, used_size, GFP_KERNEL);
> >       if (!tmp)
> >               return -ENOMEM;
> >
> > -     memcpy(tmp, &host_telemetry->body.error_count, used_size);
> > -
> >       if (checksum != amd_sriov_msg_checksum(tmp, used_size, 0, 0))
> >               goto out;
> >
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ