lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <60bf1aa7-b004-0ea7-7efc-37b4a1ea2461@intel.com>
Date:   Mon, 28 Mar 2022 13:30:01 -0700
From:   Dave Hansen <dave.hansen@...el.com>
To:     Isaku Yamahata <isaku.yamahata@...il.com>,
        Kai Huang <kai.huang@...el.com>
Cc:     linux-kernel@...r.kernel.org, kvm@...r.kernel.org,
        seanjc@...gle.com, pbonzini@...hat.com,
        kirill.shutemov@...ux.intel.com,
        sathyanarayanan.kuppuswamy@...ux.intel.com, peterz@...radead.org,
        tony.luck@...el.com, ak@...ux.intel.com, dan.j.williams@...el.com,
        isaku.yamahata@...el.com
Subject: Re: [PATCH v2 09/21] x86/virt/tdx: Get information about TDX module
 and convertible memory

On 3/28/22 13:22, Isaku Yamahata wrote:
>>>> +	/*
>>>> +	 * Also a sane BIOS should never generate invalid CMR(s) between
>>>> +	 * two valid CMRs.  Sanity check this and simply return error in
>>>> +	 * this case.
>>>> +	 */
>>>> +	for (j = i; j < cmr_num; j++)
>>>> +		if (cmr_valid(&cmr_array[j])) {
>>>> +			pr_err("Firmware bug: invalid CMR(s) among valid CMRs.\n");
>>>> +			return -EFAULT;
>>>> +		}
>>> This check doesn't make sense because above i-for loop has break.
>> The break in above i-for loop will hit at the first invalid CMR entry.  Yes "j =
>> i" will make double check on this invalid CMR entry, but it should have no
>> problem.  Or we can change to "j = i + 1" to skip the first invalid CMR entry.
>>
>> Does this make sense?
> It makes sense. Somehow I missed j = i. I scratch my review.

You can also take it as something you might want to refactor, add
comments, or work on better variable names.  If it confused one person,
it will confuse more in the future.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ