From cf0ba1ad1439f6d19b1e9e15ec0189cd4dd1b167 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Thu, 12 Mar 2026 12:55:29 -0700 Subject: [PATCH] nouveau/vmm: use kzalloc_flex Use the proper macro do to these sizeof calculations. Signed-off-by: Rosen Penev Reviewed-by: Lyude Paul [fixed style warning from checkpatch] Signed-off-by: Lyude Paul Link: https://patch.msgid.link/20260312195529.13002-1-rosenp@gmail.com --- drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c | 3 ++- 1 file changed, 2 insertions(+), 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..107bdb642f22 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c @@ -53,7 +53,8 @@ nvkm_vmm_pt_new(const struct nvkm_vmm_desc *desc, bool sparse, } } - if (!(pgt = kzalloc(sizeof(*pgt) + (sizeof(pgt->pte[0]) * lpte), GFP_KERNEL))) + pgt = kzalloc_flex(*pgt, pte, lpte); + if (!pgt) return NULL; pgt->page = page ? page->shift : 0; pgt->sparse = sparse;