Re: [PATCH v9 03/24] virt: sev-guest: Make payload a variable length array

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jun 24, 2024 at 08:00:38AM -0500, Tom Lendacky wrote:
> An alternative to the #defines would be something like:
> 
> struct snp_guest_msg {
> 	struct snp_guest_msg_hdr hdr;
> 	u8 payload[PAGE_SIZE - sizeof(struct snp_guest_msg_hdr)];
>  } __packed;
> 
> Not sure it matters, but does reduce the changes while ensuring the
> payload plus header doesn't exceed a page.

Yeah, because that would've been my next question - the requirement to keep it
<= PAGE_SIZE.

So yeah, Nikunj, please do that also and add a 

	BUILD_BUG_ON(sizeof(struct snp_guest_msg) > PAGE_SIZE);

somewhere in the driver to catch all kinds of funky stuff.

Thx.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux