ACK: [PATCH] mtrr: fix incorrect mask on amd_sys_conf
Colin Ian King
colin.king at canonical.com
Mon Jan 14 22:47:48 UTC 2019
On 14/01/2019 20:08, Alex Hung wrote:
> On 2019-01-14 9:47 a.m., Colin King wrote:
>> From: Colin Ian King <colin.king at canonical.com>
>>
>> Currently the check (amd_sys_conf | 0x200000) is always true as or'ing
>> anything with a non-zero leads to a non-zero (true) result. Fix this by
>> using an 'and' to perform the masking as was intended.
>>
>> Fixes: 9e3c4bfc050d ("mtrr: check memory type above 4GB on AMD platforms")
>> Signed-off-by: Colin Ian King <colin.king at canonical.com>
>> ---
>> src/bios/mtrr/mtrr.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/src/bios/mtrr/mtrr.c b/src/bios/mtrr/mtrr.c
>> index 453dc57b..b2576bf0 100644
>> --- a/src/bios/mtrr/mtrr.c
>> +++ b/src/bios/mtrr/mtrr.c
>> @@ -193,7 +193,7 @@ static int get_default_mtrr(fwts_framework *fw)
>> */
>> if (strstr(fwts_cpuinfo->vendor_id, "AMD")) {
>> if (fwts_cpu_readmsr(fw, 0, AMD_SYS_CFG_MSR, &amd_sys_conf) == FWTS_OK)
>> - if (amd_sys_conf | 0x200000)
>> + if (amd_sys_conf & 0x200000)
>> amd_Tom2ForceMemTypeWB = true;
>> }
>>
>>
>
> Thanks. That was a silly mistake.
I should have spotted it when reviewing it. Fortunately the static
analyzers are rather good and spotting these kind of issues.
Colin
>
> Acked-by: Alex Hung <alex.hung at canonical.com>
>
More information about the fwts-devel
mailing list