On Tue, Sep 15, 2026 at 02:26:01AM -0700, Peter Fang wrote:
struct tdx_quote_buf has a trailing flexible array member.
struct_size_t() 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_len > buf_size"
...is more readable than "data_len > buf_size - header_size".
Signed-off-by: Peter Fang <redacted>
Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
Reviewed-by: Tony Lindgren <redacted>
Reviewed-by: Xiaoyao Li <redacted>
Reviewed-by: Binbin Wu <redacted>
Reviewed-by: Kiryl Shutsemau (Meta) <kas@kernel.org>
--
Kiryl Shutsemau / Kirill A. Shutemov