Received: by 10.213.65.68 with SMTP id h4csp2152428imn; Sun, 8 Apr 2018 21:03:49 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+otpJRq5zdSJyzEq/Wvky8XjbYhnAY36VMUeqo7Ka/tHmfnxXj1xFFLpTnBaUa/INQBARm X-Received: by 2002:a17:902:e5:: with SMTP id a92-v6mr36301931pla.26.1523246629285; Sun, 08 Apr 2018 21:03:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523246629; cv=none; d=google.com; s=arc-20160816; b=sZt4vrMccUpipWpOISXKW2oCvhjLkMD8yAe9A1L4y6WztH9IFLaqbr0lrqepMgvo2v FmPE1zpMjg6PLMOv6HCoqblIegB447ujohUf8PEAThnRRiU/ougLgtcHv0ag8ljd4i+k veP9B2d6ELKdDSegocCZ7JluCoKJthAjTA7XB9xW/PiDv5r8urGw0+/zV4EbzRrzhslm Kgwy0NM/tim5ZwEAUPXq8j73eE0AucUH3NYs1JieEfNMHP1S+LKlGxnMH4Poaa3MtmOF wMnV7lM37Wt5ENkF0tYstK97wAOeCvwxwpdGOOpbSR8qJG7/WL1eWkQajo1NKoymgrRN iMUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=auDUzu2A1+Q1EPnzBc/Ut3+v2gKFBvC+XIkihtGDw6c=; b=gXwJ8tcpKwYiGFtXdoMTxVbFaSnShYgZnWCj3xtpt3XH5RjZ44WZSEBveAV6o1vKr3 RCK3EeZ+xdGnV5ifSqKkMFd6cM4zPsUd1Dh/dW5AingKRZgqQSe53pzI6Vb6fA3IE73C PMB7NtcjCwxr/m9CcsB5m3thYv9o+kulvq/+AxRE4Wh/PsMPF2V04qA0jFgKACYK5/qG A08pwkJcCDjgkCUWS30lq1bCrVIvLVD2jw6CBKfQU3c84qL3Pf/9kUEmZ7Lc7KZQtO8a 2wafIUY/kPEjSPJZ7bxKKwXpsbBYBcDOG6xiUXvcg6p7LnL9t4MPrjevn5XfrVGwSHu9 jpFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=fAAK/zuU; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g24si12020659pfe.263.2018.04.08.21.03.12; Sun, 08 Apr 2018 21:03:49 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=fAAK/zuU; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754367AbeDID6N (ORCPT + 99 others); Sun, 8 Apr 2018 23:58:13 -0400 Received: from mail-bn3nam01on0092.outbound.protection.outlook.com ([104.47.33.92]:62923 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753638AbeDIASi (ORCPT ); Sun, 8 Apr 2018 20:18:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=auDUzu2A1+Q1EPnzBc/Ut3+v2gKFBvC+XIkihtGDw6c=; b=fAAK/zuU/V13/qyPoQnlvMjg0wZsbjimTZPntmx3CcWzxbpMOeH/PmQAEdMSYtzoUsrofoCAqvkMItZS9UO8fIS3M+8QOS3DfhhbcKssQmU0UFQ1zqgaR4SIB+vYALYUtpLNmcLP5IPL5X1IXHme2j38LewD2R/PJQaVdrbmDKU= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB1128.namprd21.prod.outlook.com (52.132.133.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.696.0; Mon, 9 Apr 2018 00:18:34 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059%2]) with mapi id 15.20.0696.003; Mon, 9 Apr 2018 00:18:34 +0000 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Dan Carpenter , Jiri Kosina , Sasha Levin Subject: [PATCH AUTOSEL for 4.15 073/189] HID: roccat: prevent an out of bounds read in kovaplus_profile_activated() Thread-Topic: [PATCH AUTOSEL for 4.15 073/189] HID: roccat: prevent an out of bounds read in kovaplus_profile_activated() Thread-Index: AQHTz5gts8IieS87m02OKDWYENCcGg== Date: Mon, 9 Apr 2018 00:17:42 +0000 Message-ID: <20180409001637.162453-73-alexander.levin@microsoft.com> References: <20180409001637.162453-1-alexander.levin@microsoft.com> In-Reply-To: <20180409001637.162453-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DM5PR2101MB1128;7:hajLQNKsSLnLdshtbalAUhID/jhxPuUBjzVFPDXT6WppY1diLORafuWwsClvcl75D892BelFnCnhTC70LtSFJmAhTHhBsccpUGYehJw93+avxagQXTReP7GQ1KbfqYJ3FxYMk2RgRLdzKyF/PozyxgQsxQ4HFCf9cX72ubRLXfyk+qnYs1Ubp4sgYihgHdtqZveVEtXqGmUMR5QIRQRERzwiS1jOh0jZ4AXuLaJc9aQ+9bMZHV5yPgiOnVGe0Jnr;20:3CJ5Tgx7fF4VcgY/1j9NDpiSKCwksQRDWPCI6jdNiYPUa54oXl8s542NyJZqVSWDZqvdzi41Wxej/+gG/2qQ0ufiXaXD78T4ykn6Vf6n2u8mHAKawJmgy1eDzlpGKv9za+dVDA4YvoqI9YmHICdsiRIgfuyf1dq/xRbZYKe1d1Q= x-ms-office365-filtering-ht: Tenant X-MS-Office365-Filtering-Correlation-Id: e74ea404-f4ac-4b76-858f-08d59daf6ed9 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB1128; x-ms-traffictypediagnostic: DM5PR2101MB1128: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(85827821059158)(146099531331640); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040522)(2401047)(8121501046)(5005006)(3231221)(944501327)(52105095)(3002001)(93006095)(93001095)(10201501046)(6055026)(61426038)(61427038)(6041310)(20161123560045)(20161123564045)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011);SRVR:DM5PR2101MB1128;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB1128; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(346002)(39860400002)(396003)(376002)(366004)(39380400002)(199004)(189003)(66066001)(86362001)(59450400001)(3660700001)(3280700002)(2900100001)(25786009)(36756003)(6506007)(76176011)(2906002)(6486002)(86612001)(99286004)(102836004)(1076002)(7736002)(575784001)(97736004)(2616005)(446003)(486006)(11346002)(476003)(26005)(305945005)(6666003)(6512007)(4326008)(107886003)(478600001)(6436002)(5660300001)(10290500003)(5250100002)(22452003)(316002)(105586002)(186003)(8676002)(110136005)(54906003)(72206003)(53936002)(2501003)(68736007)(14454004)(6116002)(8936002)(3846002)(81156014)(10090500001)(106356001)(81166006)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB1128;H:DM5PR2101MB1032.namprd21.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: QrzlXskKdfde/fp0oN94OOMKRdU01GXFl+ChrzVklRG5jo2+GxcYitV1eaAcaQNTCgc+LR7cHveJfz/BClpGLx4jZQjSeYjzF26nFUrIBupbTq6+BDCKIKBREizUVi1jRginyN5/eBb7b3K4GksSfhS6bV8Nznvb7wNJKzWp2umkeut2YePfZTURLOmO/2lkXpQe1IcbKxSwIz+b3I+8p1mvKmj0b5ff2Jc7YchR0LAKZJwEZlGEjKkZFNaDJiG/gztY3OgiplqY9RQHi11/iBD3SqGlrRJoYiep/Mp/PEmUdEFZwqQvnJ2wAcRokK8zMNs56eUs745iCw3HgevoHGEx1c2tBUiCR+DxBFzaeUB0ofj0jGdI+mKkoMpDXLD/hGyEpz+rzgeSYZaMSE7jZYJjEgzeWveIcJEh2Ah+uTc= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: e74ea404-f4ac-4b76-858f-08d59daf6ed9 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:17:42.5552 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB1128 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dan Carpenter [ Upstream commit 7ad81482cad67cbe1ec808490d1ddfc420c42008 ] We get the "new_profile_index" value from the mouse device when we're handling raw events. Smatch taints it as untrusted data and complains that we need a bounds check. This seems like a reasonable warning otherwise there is a small read beyond the end of the array. Fixes: 0e70f97f257e ("HID: roccat: Add support for Kova[+] mouse") Signed-off-by: Dan Carpenter Acked-by: Silvan Jegen Signed-off-by: Jiri Kosina Signed-off-by: Sasha Levin --- drivers/hid/hid-roccat-kovaplus.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/hid/hid-roccat-kovaplus.c b/drivers/hid/hid-roccat-kov= aplus.c index 43617fb28b87..317c9c2c0a7c 100644 --- a/drivers/hid/hid-roccat-kovaplus.c +++ b/drivers/hid/hid-roccat-kovaplus.c @@ -37,6 +37,8 @@ static uint kovaplus_convert_event_cpi(uint value) static void kovaplus_profile_activated(struct kovaplus_device *kovaplus, uint new_profile_index) { + if (new_profile_index >=3D ARRAY_SIZE(kovaplus->profile_settings)) + return; kovaplus->actual_profile =3D new_profile_index; kovaplus->actual_cpi =3D kovaplus->profile_settings[new_profile_index].cp= i_startup_level; kovaplus->actual_x_sensitivity =3D kovaplus->profile_settings[new_profile= _index].sensitivity_x; --=20 2.15.1