From patchwork Tue Jul 19 23:43:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Duggan X-Patchwork-Id: 9238485 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id ED4BF6075D for ; Tue, 19 Jul 2016 23:45:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DCA2E26E81 for ; Tue, 19 Jul 2016 23:45:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CEC0326253; Tue, 19 Jul 2016 23:45:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4B2CA26253 for ; Tue, 19 Jul 2016 23:45:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752722AbcGSXpK (ORCPT ); Tue, 19 Jul 2016 19:45:10 -0400 Received: from us-mx1.synaptics.com ([192.147.44.131]:11800 "EHLO us-mx1.synaptics.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752604AbcGSXpJ (ORCPT ); Tue, 19 Jul 2016 19:45:09 -0400 Received: from unknown (HELO USW-OWA1.synaptics-inc.local) ([10.20.24.16]) by us-mx1.synaptics.com with ESMTP; 19 Jul 2016 16:45:07 -0700 Received: from sterling.synaptics-inc.local (10.4.10.91) by USW-OWA1.synaptics-inc.local (10.20.24.16) with Microsoft SMTP Server (TLS) id 14.3.248.2; Tue, 19 Jul 2016 16:45:08 -0700 From: Andrew Duggan To: , CC: Andrew Duggan , Dmitry Torokhov , Jiri Kosina , Benjamin Tissoires , Vincent Huang , Nick Dyer , Chris Healy , Nitin Chaudhary , Subject: [PATCH] Input: synaptics-rmi4: Fix maximum size check for F12 control register 8 Date: Tue, 19 Jul 2016 16:43:41 -0700 Message-ID: <1468971821-16982-1-git-send-email-aduggan@synaptics.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 X-Originating-IP: [10.4.10.91] Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP According to the RMI4 spec the maximum size of F12 control register 8 is 15 bytes. The current code incorrectly reports an error if control 8 is greater then 14. Making sensors with a control register 8 with 15 bytes unusable. Signed-off-by: Andrew Duggan Reported-by: Chris Healy Cc: stable@vger.kernel.org --- drivers/input/rmi4/rmi_f12.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/input/rmi4/rmi_f12.c b/drivers/input/rmi4/rmi_f12.c index c30fd86..9b0d9f7 100644 --- a/drivers/input/rmi4/rmi_f12.c +++ b/drivers/input/rmi4/rmi_f12.c @@ -68,7 +68,7 @@ static int rmi_f12_read_sensor_tuning(struct f12_data *f12) struct rmi_device *rmi_dev = fn->rmi_dev; int ret; int offset; - u8 buf[14]; + u8 buf[15]; int pitch_x = 0; int pitch_y = 0; int clip_x_low = 0; @@ -88,8 +88,9 @@ static int rmi_f12_read_sensor_tuning(struct f12_data *f12) offset = rmi_register_desc_calc_reg_offset(&f12->control_reg_desc, 8); - if (item->reg_size > 14) { - dev_err(&fn->dev, "F12 control8 should be 14 bytes, not: %ld\n", + if (item->reg_size > 15) { + dev_err(&fn->dev, + "F12 control8 should be a maximum of 15 bytes, not: %ld\n", item->reg_size); return -ENODEV; }