Re: [PATCH v9 06/24] virt: sev-guest: Simplify VMPCK and sequence number assignments

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

 



On 6/19/24 01:06, Nikunj A. Dadhania wrote:
> On 6/19/2024 2:57 AM, Tom Lendacky wrote:
>> On 5/30/24 23:30, Nikunj A Dadhania wrote:

> 
> I have separated patch 6 and 7 for better code review and modular changes.
> 
> The next patch simplifes this further to:
> 
> static inline u8 *get_vmpck(struct snp_guest_dev *snp_dev)
> {
> 	return snp_dev->secrets->vmpck[snp_dev->vmpck_id];
> }
> 
> static bool assign_vmpck(struct snp_guest_dev *dev, unsigned int vmpck_id)
> {
> 	if ((vmpck_id + 1) > VMPCK_MAX_NUM)

Ok, this still has the "+ 1" thing (and it should be >=, right?). How about:

	if (!(vmpck_id < VMPCK_MAX_NUM))
		return false;

Just makes it easier to read for me, but if no one else has an issue,
don't worry about it.

Thanks,
Tom

> 		return false;
> 
> 	dev->vmpck_id = vmpck_id;
> 
> 	return true;
> }
> 
> 
> Regards
> Nikunj




[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