From: Rosen Penev Date: Thu, 12 Mar 2026 19:55:29 +0000 (-0700) Subject: nouveau/vmm: use kzalloc_flex X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cf0ba1ad1439f6d19b1e9e15ec0189cd4dd1b167;p=thirdparty%2Fkernel%2Flinux.git 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 --- diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c b/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c index 958fd78080bdb..107bdb642f229 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;