Re: [PATCH] ACPI, APEI: Fixup incorrect 16-bit access width firmware bug

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

 



On Fri, Jul 21, 2017 at 12:41 PM, Song liwei <liwei.song@xxxxxxxxxxxxx> wrote:

> [Firmware Bug]: APEI: Invalid bit width + offset in GAR [0xb2/16/0/1/1]
>
> This is due to an 8-bit access width is specified for a 16-bit register,
> Do bit_width check just like what the original commit have done.

>         else if (bit_width == 64 && bit_offset == 0 && (*paddr & 0x07) == 0 &&
>             *access_bit_width < 64)
>                 *access_bit_width = 64;
> +       else if (bit_width == 16 && bit_offset == 0 && (*paddr & 0x01) == 0 &&
> +           *access_bit_width < 16)
> +               *access_bit_width = 16;

Wouldn't be better to rearrange that it will go in a sequence
(16,32,64 or 64,32,16) ?

or move bit_offset == 0 into external condion

    /* Fixup common BIOS bug */
    if (bit_offset == 0) {
      if (bit_width == 16 && (*paddr & 0x01) == 0 && *access_bit_width < 16)
               *access_bit_width = 16;
      else if (bit_width == 32 && (*paddr & 0x03) == 0 &&
*access_bit_width < 32)
               *access_bit_width = 32;
      else if (bit_width == 64 && (*paddr & 0x07) == 0 &&
*access_bit_width < 64)
               *access_bit_width = 64;
    }


It might be (I'm not sure it will make it better, just a side note)
considered to convert each internal conditional to

...if (bit_width == XX && (*paddr & YY) == 0)
               *access_bit_width = max(*access_bit_width, bit_width);

-- 
With Best Regards,
Andy Shevchenko
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux