[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9b4161be-b375-a533-efe9-f45e05fe1db0@amd.com>
Date: Wed, 19 Jun 2024 20:50:22 +0530
From: "Nikunj A. Dadhania" <nikunj@....com>
To: Tom Lendacky <thomas.lendacky@....com>, linux-kernel@...r.kernel.org,
bp@...en8.de, x86@...nel.org, kvm@...r.kernel.org
Cc: mingo@...hat.com, tglx@...utronix.de, dave.hansen@...ux.intel.com,
pgonda@...gle.com, seanjc@...gle.com, pbonzini@...hat.com
Subject: Re: [PATCH v9 06/24] virt: sev-guest: Simplify VMPCK and sequence
number assignments
On 6/19/2024 8:42 PM, Tom Lendacky wrote:
> 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:
For vmpck_id=3 which is valid, ((3 + 1) >= 4) will exit, which is not correct.
>
> if (!(vmpck_id < VMPCK_MAX_NUM))
> return false;
>
Sure, this is better.
> Just makes it easier to read for me, but if no one else has an issue,
> don't worry about it.
Thanks,
Nikunj
Powered by blists - more mailing lists