Commit b7435cf2 authored by Gustavo A. R. Silva's avatar Gustavo A. R. Silva Committed by Danilo Krummrich
Browse files

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)`

Link: https://lore.kernel.org/r/aAe5eNDnRyGnxLMX@kspp


Reviewed-by: default avatarKees Cook <kees@kernel.org>
Signed-off-by: default avatarGustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: default avatarDanilo Krummrich <dakr@kernel.org>
parent a3707f53
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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;