diff options
| author | Peter Fang <peter.fang@intel.com> | 2026-09-30 03:30:52 -0700 |
|---|---|---|
| committer | Dave Hansen <dave.hansen@linux.intel.com> | 2026-10-02 09:03:18 -0700 |
| commit | 683cc6010d113bd19693add9150a77862b1231ff (patch) | |
| tree | 333fecb8a8a3182f75aaa3766bb0f79eb650520b /scripts/Makefile.vmlinux | |
| parent | 0d3fe9bad7c9028b23f753c216d4fdc0a1c76fa7 (diff) | |
| download | linux-next-683cc6010d113bd19693add9150a77862b1231ff.tar.gz linux-next-683cc6010d113bd19693add9150a77862b1231ff.zip | |
virt: tdx-guest: Calculate the Quote buffer size safely
struct tdx_quote_buf has a trailing flexible array member.
struct_size() calculates the size of this kind of struct safely. It
handles overflow, which helps since the Quote size comes from the host.
Use it to rewrite the bounds check logic, since
"header_size + data_size > buf_size"
... is more readable than "data_size > buf_size - header_size".
This also prepares for a later change that needs the same
"header_size + data_size" calculation for the Quote buffer size.
AI was used under supervision to collect/apply feedback, review code and
workshop logs.
Signed-off-by: Peter Fang <peter.fang@intel.com>
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
Reviewed-by: Tony Lindgren <tony.lindgren@linux.intel.com>
Reviewed-by: Xiaoyao Li <xiaoyao.li@intel.com>
Reviewed-by: Binbin Wu <binbin.wu@linux.intel.com>
Reviewed-by: Kiryl Shutsemau (Meta) <kas@kernel.org>
Reviewed-by: Rick Edgecombe <rick.p.edgecombe@intel.com>
Link: https://patch.msgid.link/20260930103739.2851980-4-peter.fang@intel.com
Diffstat (limited to 'scripts/Makefile.vmlinux')
0 files changed, 0 insertions, 0 deletions
