From patchwork Tue Feb 22 17:52:41 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manoj Iyer X-Patchwork-Id: 83986 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from chlorine.canonical.com (chlorine.canonical.com [91.189.94.204]) by ozlabs.org (Postfix) with ESMTP id BE4E5B711D for ; Wed, 23 Feb 2011 04:52:54 +1100 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1PrwPq-0004pr-FM; Tue, 22 Feb 2011 17:52:50 +0000 Received: from adelie.canonical.com ([91.189.90.139]) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1PrwPn-0004pI-KW for kernel-team@lists.ubuntu.com; Tue, 22 Feb 2011 17:52:47 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by adelie.canonical.com with esmtp (Exim 4.71 #1 (Debian)) id 1PrwPn-0007mt-IZ for ; Tue, 22 Feb 2011 17:52:47 +0000 Received: from cpe-72-177-40-4.austin.res.rr.com ([72.177.40.4] helo=canonical.com) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1PrwPn-00005I-8p for kernel-team@lists.ubuntu.com; Tue, 22 Feb 2011 17:52:47 +0000 From: Manoj Iyer To: kernel-team@lists.ubuntu.com Subject: [PATCH] thinkpad-acpi: avoid keymap pitfall Date: Tue, 22 Feb 2011 11:52:41 -0600 Message-Id: <1298397161-3944-2-git-send-email-manoj.iyer@canonical.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1298397161-3944-1-git-send-email-manoj.iyer@canonical.com> References: <1298397161-3944-1-git-send-email-manoj.iyer@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.13 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: kernel-team-bounces@lists.ubuntu.com Errors-To: kernel-team-bounces@lists.ubuntu.com From: Henrique de Moraes Holschuh Change the code so that it will use the correct size for keymap entries. Do it in a way that makes it harder to screw it up in the future. Reported-by: Jaime Velasco Juan Signed-off-by: Henrique de Moraes Holschuh Signed-off-by: Matthew Garrett (cherry picked from commit fc6e756894b703952fd277a1f98a5d93e7ba847a) Signed-off-by: Manoj Iyer BugLink: http://launchpad.net/bugs/722747 Acked-by: Tim Gardner Acked-by: Brad Figg --- drivers/platform/x86/thinkpad_acpi.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index a48c80a..babc4d4 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c @@ -3093,7 +3093,8 @@ static const struct tpacpi_quirk tpacpi_hotkey_qtable[] __initconst = { TPACPI_Q_IBM('1', 'D', TPACPI_HK_Q_INIMASK), /* X22, X23, X24 */ }; -typedef u16 tpacpi_keymap_t[TPACPI_HOTKEY_MAP_LEN]; +typedef u16 tpacpi_keymap_entry_t; +typedef tpacpi_keymap_entry_t tpacpi_keymap_t[TPACPI_HOTKEY_MAP_LEN]; static int __init hotkey_init(struct ibm_init_struct *iibm) { @@ -3230,7 +3231,7 @@ static int __init hotkey_init(struct ibm_init_struct *iibm) }; #define TPACPI_HOTKEY_MAP_SIZE sizeof(tpacpi_keymap_t) -#define TPACPI_HOTKEY_MAP_TYPESIZE sizeof(tpacpi_keymap_t[0]) +#define TPACPI_HOTKEY_MAP_TYPESIZE sizeof(tpacpi_keymap_entry_t) int res, i; int status;