drm/nouveau: disp: Use __member_size() helper
Subsystems (3)
PATCH 1/1 drm/nouveau: disp: Use __member_size() helper
Use __member_size() to get the size of the flex-array member at compile time, instead of the convoluted expression __struct_size(p) - sizeof(*p)
Signed-off-by Gustavo A. R. Silva <[email protected]>
--- drivers/gpu/drm/nouveau/dispnv50/disp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/nouveau/dispnv50/disp.c +1 -1
@@ -776,7 +776,7 @@ nv50_hdmi_enable(struct drm_encoder *encoder, struct nouveau_crtc *nv_crtc,const u8 rekey =56 ;/* binary driver, and tegra, constant */ u32 max_ac_packet; DEFINE_RAW_FLEX(struct nvif_outp_infoframe_v0, args, data, 17); -const u8 data_len =__struct_size (args) -sizeof (*args); +const u8 data_len =__member_size (args->data);int ret, size; max_ac_packet = mode->htotal - mode->hdisplay;
Signature · 1 line
2.43.0
Quoted 4 lines · Gustavo A. R. Silva
Use
__member_size()to get the size of the flex-array member at compile time, instead of the convoluted expression__struct_size(p) - sizeof(*p)Signed-off-by Gustavo A. R. Silva <[email protected]>
Reviewed-by Kees Cook <[email protected]>
Signature · 1 line
Kees Cook
Quoted 4 lines · Gustavo A. R. Silva
Use
__member_size()to get the size of the flex-array member at compile time, instead of the convoluted expression__struct_size(p) - sizeof(*p)Signed-off-by Gustavo A. R. Silva <[email protected]>
Applied to drm-misc-next, thanks!