From patchwork Mon Jun 20 09:24:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Kosina X-Patchwork-Id: 9186957 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 EF60C607D1 for ; Mon, 20 Jun 2016 09:24:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D832624DA2 for ; Mon, 20 Jun 2016 09:24:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C99E31FEBD; Mon, 20 Jun 2016 09:24:47 +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 771D81FEBD for ; Mon, 20 Jun 2016 09:24:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751949AbcFTJYZ (ORCPT ); Mon, 20 Jun 2016 05:24:25 -0400 Received: from mx2.suse.de ([195.135.220.15]:49414 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751557AbcFTJYU (ORCPT ); Mon, 20 Jun 2016 05:24:20 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id CB7D0AC5B; Mon, 20 Jun 2016 09:24:12 +0000 (UTC) Date: Mon, 20 Jun 2016 11:24:12 +0200 (CEST) From: Jiri Kosina X-X-Sender: jkosina@pobox.suse.cz To: Masaki Ota cc: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, kbuild test robot Subject: [PATCH] HID: alps: pass correct sizes to hid_hw_raw_request() Message-ID: User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 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 From: Jiri Kosina Calculating size of the report as sizeof(pointer) always passess the length corresponding to the pointer type, not the underlying data report. Reported-by: kbuild test robot Signed-off-by: Jiri Kosina --- drivers/hid/hid-alps.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/hid/hid-alps.c b/drivers/hid/hid-alps.c index 098bce6..ff64c929 100644 --- a/drivers/hid/hid-alps.c +++ b/drivers/hid/hid-alps.c @@ -136,7 +136,8 @@ static int u1_read_write_register(struct hid_device *hdev, u32 address, input[7] = check_sum; ret = hid_hw_raw_request(hdev, U1_FEATURE_REPORT_ID, input, - sizeof(input), HID_FEATURE_REPORT, HID_REQ_SET_REPORT); + sizeof(u8)*U1_FEATURE_REPORT_LEN, HID_FEATURE_REPORT, + HID_REQ_SET_REPORT); if (ret < 0) { dev_err(&hdev->dev, "failed to read command (%d)\n", ret); @@ -145,8 +146,8 @@ static int u1_read_write_register(struct hid_device *hdev, u32 address, if (read_flag) { ret = hid_hw_raw_request(hdev, U1_FEATURE_REPORT_ID, readbuf, - sizeof(readbuf), HID_FEATURE_REPORT, - HID_REQ_GET_REPORT); + sizeof(u8)*U1_FEATURE_REPORT_LEN, + HID_FEATURE_REPORT, HID_REQ_GET_REPORT); if (ret < 0) { dev_err(&hdev->dev, "failed read register (%d)\n", ret);