drm/nouveau: outp: Use __member_size() helper
Subsystems (3)
PATCH 1/1 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)
Signed-off-by Gustavo A. R. Silva <[email protected]>
--- drivers/gpu/drm/nouveau/nvif/outp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nvif/outp.c +1 -1
@@ -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 ;
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!