Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1110731imm; Wed, 1 Aug 2018 10:21:07 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfLjF4UojwjQ1E3RqCAPz/93Z6xsI9/exdFqK6VJ43ZOheDML7uk4U7aEtZ2ETpASqBM4Xd X-Received: by 2002:a62:3f55:: with SMTP id m82-v6mr27788907pfa.51.1533144067429; Wed, 01 Aug 2018 10:21:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533144067; cv=none; d=google.com; s=arc-20160816; b=d409hQhFl595T+TTO8dlkRMZ0EjmaTvWLztqeoPck3Y4ja5lBWuhmxAxqTz2b5bOTK MgGZII0dan262iTv7RZIkirxwthO2lCYZZ99sZb6A4nUQ0andGLDTuPn/SWjzaZhLzNT RTxOyhSwennWl/+ycFokoroYgDzobDYu7O9be3AT6bfKjXBgDDT+zI4vFnRCvfMFFLJB gDT2c57z3bS2syB2LbsxP3+pZujA3Bu/7pWvD5441l+N8EyynwPIIcUgBTBsPevmR4wV C61PN/pDaDgepkhuVQ785yZayJnYUwyL7z20FHpp/az4irItM7kiPMI5K4Z+BY37KgAI N8CQ== 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=UFjyC3bSJecepBLZN1Ztqj9sTXOFwXG3hu4u2I58sdc=; b=Ej4V+itevoO742f8BXfk2kFRCLpy5pWcig3DR7ZAwwzUjWgx/mERHwTBkEGrn7uBJn 38wXHwenwJUIdoZws6WKPTysa50MuPL5r8AoEf5L0SIipWpICh94AR5s/T3/hGLXmJ7a 3ZmcWVpvWaFRqjzkPa8jSYScGpJuKIvULfKK9+DZGa6+jbvnvk2YQ15UXRdVKFdkq2zf EfTeWgeZlHWb3ioh1+z6pZ50Nb5LMipv+EQr6KvfqVxv3AVmZGh+O2IQrjfyCPh+emvx QJ3UElrtao+xA618ADSZwr4rGCyEWhQFhXDS2Hf+EiLA1OQYi2ixQPq4QgKq2c1TIP2T FzLg== 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 y186-v6si17582305pgb.395.2018.08.01.10.20.52; Wed, 01 Aug 2018 10:21:07 -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 S2405156AbeHATF5 (ORCPT + 99 others); Wed, 1 Aug 2018 15:05:57 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:48180 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2403884AbeHATF5 (ORCPT ); Wed, 1 Aug 2018 15:05:57 -0400 Received: from localhost (D57E6652.static.ziggozakelijk.nl [213.126.102.82]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id B16EACD1; Wed, 1 Aug 2018 17:19:16 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xinming Hu , Kalle Valo , Sasha Levin Subject: [PATCH 4.14 111/246] mwifiex: correct histogram data with appropriate index Date: Wed, 1 Aug 2018 18:50:21 +0200 Message-Id: <20180801165017.022407126@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180801165011.700991984@linuxfoundation.org> References: <20180801165011.700991984@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: Xinming Hu [ Upstream commit 30bfce0b63fa68c14ae1613eb9d259fa18644074 ] Correct snr/nr/rssi data index to avoid possible buffer underflow. Signed-off-by: Xinming Hu Signed-off-by: Kalle Valo Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/net/wireless/marvell/mwifiex/util.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) --- a/drivers/net/wireless/marvell/mwifiex/util.c +++ b/drivers/net/wireless/marvell/mwifiex/util.c @@ -708,12 +708,14 @@ void mwifiex_hist_data_set(struct mwifie s8 nflr) { struct mwifiex_histogram_data *phist_data = priv->hist_data; + s8 nf = -nflr; + s8 rssi = snr - nflr; atomic_inc(&phist_data->num_samples); atomic_inc(&phist_data->rx_rate[rx_rate]); - atomic_inc(&phist_data->snr[snr]); - atomic_inc(&phist_data->noise_flr[128 + nflr]); - atomic_inc(&phist_data->sig_str[nflr - snr]); + atomic_inc(&phist_data->snr[snr + 128]); + atomic_inc(&phist_data->noise_flr[nf + 128]); + atomic_inc(&phist_data->sig_str[rssi + 128]); } /* function to reset histogram data during init/reset */