Re: [PATCH] nouveau/vmm: use kzalloc_flex

From: lyude

Date: Fri May 08 2026 - 14:29:55 EST


Sorry I didn't notice this patch until now!

Reviewed-by: Lyude Paul <lyude@xxxxxxxxxx>

Will push it to drm-misc-next in just a moment

On Thu, 2026-03-12 at 12:55 -0700, Rosen Penev wrote:
> Use the proper macro do to these sizeof calculations.
>
> Signed-off-by: Rosen Penev <rosenp@xxxxxxxxx>
> ---
>  drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c
> b/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c
> index 958fd78080bd..b9648290dffb 100644
> --- a/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c
> +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c
> @@ -53,7 +53,7 @@ nvkm_vmm_pt_new(const struct nvkm_vmm_desc *desc,
> bool sparse,
>   }
>   }
>  
> - if (!(pgt = kzalloc(sizeof(*pgt) + (sizeof(pgt->pte[0]) *
> lpte), GFP_KERNEL)))
> + if (!(pgt = kzalloc_flex(*pgt, pte, lpte)))
>   return NULL;
>   pgt->page = page ? page->shift : 0;
>   pgt->sparse = sparse;