Received: by 10.192.165.148 with SMTP id m20csp528821imm; Wed, 25 Apr 2018 03:44:20 -0700 (PDT) X-Google-Smtp-Source: AIpwx48PSl6eIqgM9xbEju6vDvM8dxtiHiYwD+MtJnwHoUMej/ZOyArNq96neaiWcIH1I7ONUVqx X-Received: by 10.98.80.80 with SMTP id e77mr27788513pfb.16.1524653060309; Wed, 25 Apr 2018 03:44:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524653060; cv=none; d=google.com; s=arc-20160816; b=pzWukxWqz7QKLslm3z0YLFI6L9uECN1YDqGTHcZW8OGnjzt1kwYpQXonWKvFihibN0 pVIxLQPSFTGu2c8q/W2WZsdhfu+IjquWfR8POJc/ZwxDXKVqW5ebGMizZnXxBWuiB7qT zK/0FPlOSd68eRKlSOq0Vb40BJKc+XiRN7L/fXriJr2aNT2lWd21pKpXPJDF79DLoSap ApmEHbFxO4rySr1y6S6QN5qMwb4PiIFn33EsAoUbMmGQMtVMsFXWA7MD+DhPCFMhnIrb 9sgZAnR5Zf9FJqwQekOF1xM7/yWZKvG7EYuVNfCOj6oolxSLBo7s9K2CZQqZmLQg62Ge JFtQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=3/wOuH/uK930gu39Wp64NG+Hi+2VTGRxLtroj8Qw8iM=; b=YYJsq7ls7nnmJzt6b5qAkaOSPueCDhQvHxDsk12H14CFsuMvqwmPAk6Lw8SskQu7n3 HcNxk28v4n9/Q0Wk9w37KukZwrmu2DPS+Lv8KloiUYYfJ/OCea+Sb1mHk6DQMupSaDru vP1WyVLRLDuTeCXUrs7D4RrdbjM1jseR/M+qOIo/2lK7hGuaNO6vNtELUWnvis7Py3sc oo/ZlDhvMlCSzUoBUzbNYv+ajIhHPYuKcsQM8R6WnmcrubXBgW/A0ydICgbY/ziYOFE1 LDptenReh86n41lntLqy5EGGHRMkj2GXl0IySWQxpgwVBPcV7MPQGD5NUFAfuyr9TM5H fk5w== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t6si14173893pfg.114.2018.04.25.03.44.06; Wed, 25 Apr 2018 03:44:20 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754033AbeDYKlw (ORCPT + 99 others); Wed, 25 Apr 2018 06:41:52 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:52430 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753997AbeDYKlj (ORCPT ); Wed, 25 Apr 2018 06:41:39 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 9B323480; Wed, 25 Apr 2018 10:41:38 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Silvan Jegen , Jiri Kosina , Sasha Levin Subject: [PATCH 4.14 074/183] HID: roccat: prevent an out of bounds read in kovaplus_profile_activated() Date: Wed, 25 Apr 2018 12:34:54 +0200 Message-Id: <20180425103245.490352414@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180425103242.532713678@linuxfoundation.org> References: <20180425103242.532713678@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ 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 Signed-off-by: Greg Kroah-Hartman --- drivers/hid/hid-roccat-kovaplus.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/hid/hid-roccat-kovaplus.c +++ b/drivers/hid/hid-roccat-kovaplus.c @@ -37,6 +37,8 @@ static uint kovaplus_convert_event_cpi(u static void kovaplus_profile_activated(struct kovaplus_device *kovaplus, uint new_profile_index) { + if (new_profile_index >= ARRAY_SIZE(kovaplus->profile_settings)) + return; kovaplus->actual_profile = new_profile_index; kovaplus->actual_cpi = kovaplus->profile_settings[new_profile_index].cpi_startup_level; kovaplus->actual_x_sensitivity = kovaplus->profile_settings[new_profile_index].sensitivity_x;