Re: [PATCH] drm: amdgpu: Use the correct size when allocating memory

2020-08-11 Thread Dan Carpenter
On Tue, Aug 11, 2020 at 10:57:02AM +0300, Dan Carpenter wrote: > On Mon, Aug 10, 2020 at 08:41:14PM +0200, Marion & Christophe JAILLET wrote: > > > > Le 10/08/2020 à 17:42, Dan Carpenter a écrit : > > > On Sun, Aug 09, 2020 at 10:34:06PM +0200, Christophe JAILLET wrote: > > > > When '*sgt' is allo

Re: [PATCH] drm: amdgpu: Use the correct size when allocating memory

2020-08-11 Thread Dan Carpenter
On Mon, Aug 10, 2020 at 08:41:14PM +0200, Marion & Christophe JAILLET wrote: > > Le 10/08/2020 à 17:42, Dan Carpenter a écrit : > > On Sun, Aug 09, 2020 at 10:34:06PM +0200, Christophe JAILLET wrote: > > > When '*sgt' is allocated, we must allocated 'sizeof(**sgt)' bytes instead > > > of 'sizeof(*

Re: [PATCH] drm: amdgpu: Use the correct size when allocating memory

2020-08-11 Thread Marion & Christophe JAILLET
Le 10/08/2020 à 17:42, Dan Carpenter a écrit : On Sun, Aug 09, 2020 at 10:34:06PM +0200, Christophe JAILLET wrote: When '*sgt' is allocated, we must allocated 'sizeof(**sgt)' bytes instead of 'sizeof(*sg)'. 'sg' (i.e. struct scatterlist) is smaller than 'sgt' (i.e struct sg_table), so this coul

Re: [PATCH] drm: amdgpu: Use the correct size when allocating memory

2020-08-10 Thread Alex Deucher
Applied and updated the commit message to reflect the sizes. Thanks! Alex On Mon, Aug 10, 2020 at 3:07 PM Marion & Christophe JAILLET wrote: > > > Le 10/08/2020 à 17:42, Dan Carpenter a écrit : > > On Sun, Aug 09, 2020 at 10:34:06PM +0200, Christophe JAILLET wrote: > >> When '*sgt' is allocated

Re: [PATCH] drm: amdgpu: Use the correct size when allocating memory

2020-08-10 Thread Dan Carpenter
On Sun, Aug 09, 2020 at 10:34:06PM +0200, Christophe JAILLET wrote: > When '*sgt' is allocated, we must allocated 'sizeof(**sgt)' bytes instead > of 'sizeof(*sg)'. 'sg' (i.e. struct scatterlist) is smaller than > 'sgt' (i.e struct sg_table), so this could lead to memory corruption. The sizeof(*sg)

Re: [PATCH] drm: amdgpu: Use the correct size when allocating memory

2020-08-10 Thread Christian König
Am 09.08.20 um 22:34 schrieb Christophe JAILLET: When '*sgt' is allocated, we must allocated 'sizeof(**sgt)' bytes instead of 'sizeof(*sg)'. 'sg' (i.e. struct scatterlist) is smaller than 'sgt' (i.e struct sg_table), so this could lead to memory corruption. Fixes: f44ffd677fb3 ("drm/amdgpu: add

[PATCH] drm: amdgpu: Use the correct size when allocating memory

2020-08-10 Thread Christophe JAILLET
When '*sgt' is allocated, we must allocated 'sizeof(**sgt)' bytes instead of 'sizeof(*sg)'. 'sg' (i.e. struct scatterlist) is smaller than 'sgt' (i.e struct sg_table), so this could lead to memory corruption. Fixes: f44ffd677fb3 ("drm/amdgpu: add support for exporting VRAM using DMA-buf v3") Sign