iommu/amd: Use struct_group() for memcpy() region
authorKees Cook <keescook@chromium.org>
Tue, 18 May 2021 18:31:22 +0000 (11:31 -0700)
committerKees Cook <keescook@chromium.org>
Sat, 25 Sep 2021 15:20:48 +0000 (08:20 -0700)
commit43d83af8a57a0500d452a2505b297e605012960d
treeaacda691c2bc6dca1a4d771cba0da112c8d84c72
parent241fe395e8fe647b3433d9ac2bf863e0651d8eca
iommu/amd: Use struct_group() for memcpy() region

In preparation for FORTIFY_SOURCE performing compile-time and run-time
field bounds checking for memcpy(), memmove(), and memset(), avoid
intentionally writing across neighboring fields.

Use struct_group() in struct ivhd_entry around members ext and hidh, so
they can be referenced together. This will allow memcpy() and sizeof()
to more easily reason about sizes, improve readability, and avoid future
warnings about writing beyond the end of ext.

"pahole" shows no size nor member offset changes to struct ivhd_entry.
"objdump -d" shows no object code changes.

Cc: Will Deacon <will@kernel.org>
Cc: iommu@lists.linux-foundation.org
Acked-by: Joerg Roedel <jroedel@suse.de>
Signed-off-by: Kees Cook <keescook@chromium.org>
drivers/iommu/amd/init.c