From: Rosen Penev Date: Fri, 8 May 2026 05:20:56 +0000 (-0700) Subject: drm/nouveau/gsp: Use kzalloc_flex() for r535 display funcs X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1307a5a1eac20aacf32495491f28c32c0a419dc9;p=thirdparty%2Fkernel%2Flinux.git drm/nouveau/gsp: Use kzalloc_flex() for r535 display funcs struct nvkm_disp_func ends with the user flexible array member. Allocate the r535 display function table with kzalloc_flex() instead of open-coding the size calculation with sizeof(). Assisted-by: Codex:GPT-5.5 Signed-off-by: Rosen Penev Reviewed-by: Lyude Paul [dropped nothing-burger sentence from commit message] Signed-off-by: Lyude Paul Link: https://patch.msgid.link/20260508052056.1744665-1-rosenp@gmail.com --- diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/disp.c b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/disp.c index 6e63df816d855..1155f079b0c3d 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/disp.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/disp.c @@ -1734,7 +1734,8 @@ r535_disp_new(const struct nvkm_disp_func *hw, struct nvkm_device *device, struct nvkm_disp_func *rm; int ret; - if (!(rm = kzalloc(sizeof(*rm) + 6 * sizeof(rm->user[0]), GFP_KERNEL))) + rm = kzalloc_flex(*rm, user, 6); + if (!rm) return -ENOMEM; rm->dtor = r535_disp_dtor;