Re: linux-4.4-rc8/drivers/platform/x86/thinkpad_acpi.c: 2 * bad shift ?

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

 



On Mon, 04 Jan 2016, David Binderman wrote:
> 1.
> 
> [linux-4.4-rc8/drivers/platform/x86/thinkpad_acpi.c:2297] -> [linux-4.4-rc8/drivers/platform/x86/thinkpad_acpi.c:3694]: (warning) Shifting 32-bit value by 51 bits is undefined behaviour. See condition at line 3694.
> 
> Source code at line 2297 is
> 
>     if (hotkey_user_mask & (1 << scancode))
> 
> and at 3694 is
> 
>     if (scancode> 0 && scancode <= TPACPI_HOTKEY_MAP_LEN) {
> 
> Maybe new code
> 
>     if (hotkey_user_mask & (1UL << scancode))
> 
> is better.

You are correct that this is buggy.  Thank you for the report!

Scancodes 32 (0x20) and above were added to the keymap to support the
adaptative keyboard in the X1 carbon (which Lenovo has since abandoned).
They are not present in the legacy firmware event mask (which is what that
shift addresses).

We could just always issue the hotkey event for these scan codes, and if the
user doesn't want such an event, he can use the standard interfaces to set
the keycode in the keymap to KEY_RESERVED.

I will just read up a bit on the patches and ML discussions that resulted in
this change to check if there is a new firmware event mask we should be
checking, and prepare a fix.

I will need help from someone that has an adaptative keyboard to test the
patches, though.

-- 
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
ibm-acpi-devel mailing list
ibm-acpi-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/ibm-acpi-devel




[Index of Archives]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Photo]     [Yosemite Photos]     [Yosemite Advice]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]

  Powered by Linux