[kbuild] [next:master 2183/8741] drivers/platform/x86/thinkpad_acpi.c:3683 adaptive_keyboard_hotkey_notify_hotkey() error: buffer overflow 'hotkey_keycode_map' 32 <= 52

2015-04-05 Thread kbuild test robot
TO: Bastien Nocera 
CC: Darren Hart 

tree:   git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   b0a12fb5bc87820b12df22c64dd680a96443de00
commit: 6a68d855708497c542d57a82a5f8e3a513a65a82 [2183/8741] thinkpad_acpi: Add 
support for more adaptive kbd buttons
:: branch date: 3 days ago
:: commit date: 5 weeks ago

New smatch warnings:
drivers/platform/x86/thinkpad_acpi.c:3683 
adaptive_keyboard_hotkey_notify_hotkey() error: buffer overflow 
'hotkey_keycode_map' 32 <= 52

Old smatch warnings:
drivers/platform/x86/thinkpad_acpi.c:2962 adaptive_kbd_mode_show() warn: 
unsigned 'current_mode' is never less than zero.
drivers/platform/x86/thinkpad_acpi.c:3653 
adaptive_keyboard_hotkey_notify_hotkey() warn: unsigned 'current_mode' is never 
less than zero.
drivers/platform/x86/thinkpad_acpi.c:3666 
adaptive_keyboard_hotkey_notify_hotkey() warn: unsigned 'current_mode' is never 
less than zero.

git remote add next 
git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
git remote update next
git checkout 6a68d855708497c542d57a82a5f8e3a513a65a82
vim +/hotkey_keycode_map +3683 drivers/platform/x86/thinkpad_acpi.c

3a9d20bd Shuduo Sang2014-03-06  3667return false;
f74587fb Bastien Nocera 2015-03-02  3668  
f74587fb Bastien Nocera 2015-03-02  3669
adaptive_keyboard_prev_mode = current_mode;
3a9d20bd Shuduo Sang2014-03-06  3670
adaptive_keyboard_mode_is_saved = true;
3a9d20bd Shuduo Sang2014-03-06  3671  
f74587fb Bastien Nocera 2015-03-02  3672if 
(adaptive_keyboard_set_mode (FUNCTION_MODE) < 0)
3a9d20bd Shuduo Sang2014-03-06  3673return false;
3a9d20bd Shuduo Sang2014-03-06  3674return true;
3a9d20bd Shuduo Sang2014-03-06  3675  
3a9d20bd Shuduo Sang2014-03-06  3676default:
6a68d855 Bastien Nocera 2015-03-02  3677if (scancode < 
FIRST_ADAPTIVE_KEY || scancode > FIRST_ADAPTIVE_KEY +
6a68d855 Bastien Nocera 2015-03-02  3678
TPACPI_HOTKEY_MAP_LEN - ADAPTIVE_KEY_OFFSET) {
6a68d855 Bastien Nocera 2015-03-02  3679
pr_info("Unhandled adaptive keyboard key: 0x%x\n",
6a68d855 Bastien Nocera 2015-03-02  3680
scancode);
3a9d20bd Shuduo Sang2014-03-06  3681return false;
3a9d20bd Shuduo Sang2014-03-06  3682}
6a68d855 Bastien Nocera 2015-03-02 @3683keycode = 
hotkey_keycode_map[scancode - FIRST_ADAPTIVE_KEY + ADAPTIVE_KEY_OFFSET];
6a68d855 Bastien Nocera 2015-03-02  3684if (keycode != 
KEY_RESERVED) {
6a68d855 Bastien Nocera 2015-03-02  3685
mutex_lock(&tpacpi_inputdev_send_mutex);
6a68d855 Bastien Nocera 2015-03-02  3686  
6a68d855 Bastien Nocera 2015-03-02  3687
input_report_key(tpacpi_inputdev, keycode, 1);
6a68d855 Bastien Nocera 2015-03-02  3688
input_sync(tpacpi_inputdev);
6a68d855 Bastien Nocera 2015-03-02  3689  
6a68d855 Bastien Nocera 2015-03-02  3690
input_report_key(tpacpi_inputdev, keycode, 0);
6a68d855 Bastien Nocera 2015-03-02  3691
input_sync(tpacpi_inputdev);

---
0-DAY kernel test infrastructureOpen Source Technology Center
http://lists.01.org/mailman/listinfo/kbuild Intel Corporation
___
kbuild mailing list
kbuild@lists.01.org
https://lists.01.org/mailman/listinfo/kbuild


Re: [kbuild] [next:master 2183/8741] drivers/platform/x86/thinkpad_acpi.c:3683 adaptive_keyboard_hotkey_notify_hotkey() error: buffer overflow 'hotkey_keycode_map' 32 <= 52

2015-04-07 Thread Dan Carpenter
I sent a patch for this already.

regards,
dan carpenter

On Mon, Apr 06, 2015 at 12:41:13AM +0800, kbuild test robot wrote:
> TO: Bastien Nocera 
> CC: Darren Hart 
> 
> tree:   git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git 
> master
> head:   b0a12fb5bc87820b12df22c64dd680a96443de00
> commit: 6a68d855708497c542d57a82a5f8e3a513a65a82 [2183/8741] thinkpad_acpi: 
> Add support for more adaptive kbd buttons
> :: branch date: 3 days ago
> :: commit date: 5 weeks ago
> 
> New smatch warnings:
> drivers/platform/x86/thinkpad_acpi.c:3683 
> adaptive_keyboard_hotkey_notify_hotkey() error: buffer overflow 
> 'hotkey_keycode_map' 32 <= 52
> 
> Old smatch warnings:
> drivers/platform/x86/thinkpad_acpi.c:2962 adaptive_kbd_mode_show() warn: 
> unsigned 'current_mode' is never less than zero.
> drivers/platform/x86/thinkpad_acpi.c:3653 
> adaptive_keyboard_hotkey_notify_hotkey() warn: unsigned 'current_mode' is 
> never less than zero.
> drivers/platform/x86/thinkpad_acpi.c:3666 
> adaptive_keyboard_hotkey_notify_hotkey() warn: unsigned 'current_mode' is 
> never less than zero.
> 
> git remote add next 
> git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
> git remote update next
> git checkout 6a68d855708497c542d57a82a5f8e3a513a65a82
> vim +/hotkey_keycode_map +3683 drivers/platform/x86/thinkpad_acpi.c
> 
> 3a9d20bd Shuduo Sang2014-03-06  3667  return false;
> f74587fb Bastien Nocera 2015-03-02  3668  
> f74587fb Bastien Nocera 2015-03-02  3669  
> adaptive_keyboard_prev_mode = current_mode;
> 3a9d20bd Shuduo Sang2014-03-06  3670  
> adaptive_keyboard_mode_is_saved = true;
> 3a9d20bd Shuduo Sang2014-03-06  3671  
> f74587fb Bastien Nocera 2015-03-02  3672  if 
> (adaptive_keyboard_set_mode (FUNCTION_MODE) < 0)
> 3a9d20bd Shuduo Sang2014-03-06  3673  return false;
> 3a9d20bd Shuduo Sang2014-03-06  3674  return true;
> 3a9d20bd Shuduo Sang2014-03-06  3675  
> 3a9d20bd Shuduo Sang2014-03-06  3676  default:
> 6a68d855 Bastien Nocera 2015-03-02  3677  if (scancode < 
> FIRST_ADAPTIVE_KEY || scancode > FIRST_ADAPTIVE_KEY +
> 6a68d855 Bastien Nocera 2015-03-02  3678  
> TPACPI_HOTKEY_MAP_LEN - ADAPTIVE_KEY_OFFSET) {
> 6a68d855 Bastien Nocera 2015-03-02  3679  
> pr_info("Unhandled adaptive keyboard key: 0x%x\n",
> 6a68d855 Bastien Nocera 2015-03-02  3680  
> scancode);
> 3a9d20bd Shuduo Sang2014-03-06  3681  return false;
> 3a9d20bd Shuduo Sang2014-03-06  3682  }
> 6a68d855 Bastien Nocera 2015-03-02 @3683  keycode = 
> hotkey_keycode_map[scancode - FIRST_ADAPTIVE_KEY + ADAPTIVE_KEY_OFFSET];
> 6a68d855 Bastien Nocera 2015-03-02  3684  if (keycode != 
> KEY_RESERVED) {
> 6a68d855 Bastien Nocera 2015-03-02  3685  
> mutex_lock(&tpacpi_inputdev_send_mutex);
> 6a68d855 Bastien Nocera 2015-03-02  3686  
> 6a68d855 Bastien Nocera 2015-03-02  3687  
> input_report_key(tpacpi_inputdev, keycode, 1);
> 6a68d855 Bastien Nocera 2015-03-02  3688  
> input_sync(tpacpi_inputdev);
> 6a68d855 Bastien Nocera 2015-03-02  3689  
> 6a68d855 Bastien Nocera 2015-03-02  3690  
> input_report_key(tpacpi_inputdev, keycode, 0);
> 6a68d855 Bastien Nocera 2015-03-02  3691  
> input_sync(tpacpi_inputdev);
> 
> ---
> 0-DAY kernel test infrastructureOpen Source Technology Center
> http://lists.01.org/mailman/listinfo/kbuild Intel Corporation
___
kbuild mailing list
kbuild@lists.01.org
https://lists.01.org/mailman/listinfo/kbuild