mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-03 20:34:23 -04:00
drm/nouveau: outp: 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/aAe5o_-f5OYSTXjZ@kspp Reviewed-by: Kees Cook <kees@kernel.org> Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org> Signed-off-by: Danilo Krummrich <dakr@kernel.org>
This commit is contained in:
committed by
Danilo Krummrich
parent
b7435cf2d9
commit
c48b28e4ef
@@ -198,7 +198,7 @@ nvif_outp_hda_eld(struct nvif_outp *outp, int head, void *data, u32 size)
|
||||
DEFINE_RAW_FLEX(struct nvif_outp_hda_eld_v0, mthd, data, 128);
|
||||
int ret;
|
||||
|
||||
if (WARN_ON(size > (__struct_size(mthd) - sizeof(*mthd))))
|
||||
if (WARN_ON(size > __member_size(mthd->data)))
|
||||
return -EINVAL;
|
||||
|
||||
mthd->version = 0;
|
||||
|
||||
Reference in New Issue
Block a user