lkml.org 
[lkml]   [2022]   [Aug]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH v5] x86/mce: retrieve poison range from hardware
Date
On 8/1/2022 8:58 AM, Luck, Tony wrote:
>> struct mce m;
>> + int lsb = PAGE_SHIFT;
>
> Some maintainers like to order local declaration lines from longest to shortest
>
>> + /*
>> + * Even if the ->validation_bits are set for address mask,
>> + * to be extra safe, check and reject an error radius '0',
>> + * and fallback to the default page size.
>> + */
>> + if (mem_err->validation_bits & CPER_MEM_VALID_PA_MASK) {
>> + lsb = __ffs64(mem_err->physical_addr_mask);
>> + if (lsb == 1)
>> + lsb = PAGE_SHIFT;
>> + }
>
>
> The comment above __ffs64() says:
>
> * The result is not defined if no bits are set, so check that @word
> * is non-zero before calling this.
>
> So if the intent is "extra safe" should check for that:
>
> if (mem_err->validation_bits & CPER_MEM_VALID_PA_MASK &&
> mem_err->physical_addr_mask) {
> lsb = __ffs64(mem_err->physical_addr_mask);
> if (lsb == 1)
> lsb = PAGE_SHIFT;
> }

Indeed, thanks a lot!

-jane


>
> -Tony
>
>
>

\
 
 \ /
  Last update: 2022-08-01 22:32    [W:0.117 / U:0.036 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site