Re: [PATCH] nouveau/dmem: handle kcalloc() allocation failure

2024-03-05 Thread Danilo Krummrich
Hi Duoming, On 3/3/24 08:53, Duoming Zhou wrote: The kcalloc() in nouveau_dmem_evict_chunk() will return null if the physical memory has run out. As a result, if we dereference src_pfns, dst_pfns or dma_addrs, the null pointer dereference bugs will happen. This patch uses stack variables to

Re: [PATCH] nouveau/dmem: handle kcalloc() allocation failure

2024-03-05 Thread Jani Nikula
On Tue, 05 Mar 2024, duom...@zju.edu.cn wrote: > On Mon, 04 Mar 2024 14:14:52 +0200 Jani Nikula wrote: >> >> The kcalloc() in nouveau_dmem_evict_chunk() will return null if >> >> the physical memory has run out. As a result, if we dereference >> >> src_pfns, dst_pfns or dma_addrs, the null pointer

Re: [PATCH] nouveau/dmem: handle kcalloc() allocation failure

2024-03-05 Thread duoming
On Mon, 04 Mar 2024 14:14:52 +0200 Jani Nikula wrote: > >> The kcalloc() in nouveau_dmem_evict_chunk() will return null if > >> the physical memory has run out. As a result, if we dereference > >> src_pfns, dst_pfns or dma_addrs, the null pointer dereference bugs > >> will happen. > >> > >> This

Re: [PATCH] nouveau/dmem: handle kcalloc() allocation failure

2024-03-04 Thread Jani Nikula
On Sun, 03 Mar 2024, Timur Tabi wrote: > On Sun, Mar 3, 2024 at 4:46 AM Duoming Zhou wrote: >> >> The kcalloc() in nouveau_dmem_evict_chunk() will return null if >> the physical memory has run out. As a result, if we dereference >> src_pfns, dst_pfns or dma_addrs, the null pointer dereference

Re: [PATCH] nouveau/dmem: handle kcalloc() allocation failure

2024-03-03 Thread Timur Tabi
On Sun, Mar 3, 2024 at 4:46 AM Duoming Zhou wrote: > > The kcalloc() in nouveau_dmem_evict_chunk() will return null if > the physical memory has run out. As a result, if we dereference > src_pfns, dst_pfns or dma_addrs, the null pointer dereference bugs > will happen. > > This patch uses stack

[PATCH] nouveau/dmem: handle kcalloc() allocation failure

2024-03-03 Thread Duoming Zhou
The kcalloc() in nouveau_dmem_evict_chunk() will return null if the physical memory has run out. As a result, if we dereference src_pfns, dst_pfns or dma_addrs, the null pointer dereference bugs will happen. This patch uses stack variables to replace the kcalloc(). Fixes: 249881232e14