Skip to contentSkip to conversation

nouveau/vmm: use kzalloc_flex

PATCH In review Rosen Penev 2 participants 2 messages Mar 12 – May 8

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nouveau/vmm: use kzalloc_flex

Use the proper macro do to these sizeof calculations.

---
 drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c +1 -1
index 958fd78080bd..b9648290dffb 100644
@@ -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;
Signature · 1 line
2.53.0
maintainer Reviewed-by on v1 1/1
#1 lore raw

Sorry I didn't notice this patch until now!

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

Quoted 23 lines · Rosen Penev

Use the proper macro do to these sizeof calculations.

---
 drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c | 2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c +0 -0
index 958fd78080bd..b9648290dffb 100644
@@ -53,7 +53,7 @@ nvkm_vmm_pt_new(const struct nvkm_vmm_desc *desc,
 bool sparse,
  		}
  	}

drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c +0 -1
-	if (!(pgt = kzalloc(sizeof(*pgt) + (sizeof(pgt->pte[0]) *

lpte), GFP_KERNEL)))

drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c +1 -0
+	if (!(pgt = kzalloc_flex(*pgt, pte, lpte)))

  return NULL;
  pgt->page = page ? page->shift : 0;
  pgt->sparse = sparse;