Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp810584imm; Fri, 5 Oct 2018 12:10:37 -0700 (PDT) X-Google-Smtp-Source: ACcGV618wfNPQ5JuF2PPS+CKPm8ygALIvFvUjJZwPCX41hcjXyM998GmmQy3w3A6dRLhjcIvW7bF X-Received: by 2002:a65:66c9:: with SMTP id c9-v6mr11358544pgw.55.1538766636931; Fri, 05 Oct 2018 12:10:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538766636; cv=none; d=google.com; s=arc-20160816; b=gtcLfDcvnZo2gu5HWpQ43xIP0y3SP/EuTPhliz/u3vDUASjMG+aT1wyxTclu4uI+Om /3IsBZunOiuCN9ek1SzqRSPqYjo8tr8FbtQRIu/EukBRZ1VuiGmpO1t9ee4otDuw9ghR +5Hg4U3jt4GetFXh0pe5SNT1jQESXUSlhZy4o9uL5WmHC4uQC1kaNZSDOi9iAM74kb9F 1euBtG2qWJLPxo4qjMme4js+G7+6BZblb6YDYAjQCTo1QkRJ9eGDA+5HmGOGROpzA6Ws iU2uA7uiwIPN37CJEd7nflZUxyLbVleD5AbcaDlHUFMGqHXFhN9qoI6imncuz3+Q5ClJ 9F5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:organization:from:cc :references:to:subject; bh=/Wl4sijxiZ+bDEJ2WTD/8US16HEL7Quz2/9eERRbtiY=; b=qkOjG4VslkU168PJlFINCWroplWVSwfXJTVVmPs1ZvYp3rwzD1XEAlBZ8rQkfPCO4i f5db0E0V1yq0nbF158Ajw52Il1qt0wcafzfzFqUiqFnGST8xIfP4JbGQNgBdbuzRERV8 qLTHZK7olxElPe6rH2/wfZYuVX6FXID343YjqTVxYQ6IWDt69zdgB1VQX24oKAdmPqoJ xNTem8hWIVQZXLqH1aAxSaT3THYqaFcmzGHR5/qKIQXyzx0GdG40FdHBc2p/ofsCFQ8+ ZbjN5NwL2gGEWP9evxpzWkDY02ZEX4cN7D7EKPflktfpnWcCEXetrn1CFVOJKC7jzn5p YdXQ== 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 gn22si8824224plb.139.2018.10.05.12.10.21; Fri, 05 Oct 2018 12:10:36 -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 S1728876AbeJFCJ6 (ORCPT + 99 others); Fri, 5 Oct 2018 22:09:58 -0400 Received: from mail2.candelatech.com ([208.74.158.173]:57254 "EHLO mail2.candelatech.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728139AbeJFCJ5 (ORCPT ); Fri, 5 Oct 2018 22:09:57 -0400 Received: from [192.168.100.149] (firewall.candelatech.com [50.251.239.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail2.candelatech.com (Postfix) with ESMTPSA id B4E3E40A30A; Fri, 5 Oct 2018 12:09:50 -0700 (PDT) Subject: Re: [PATCH] ath10k: htt_rx: Fix signedness bug in ath10k_update_per_peer_tx_stats To: "Gustavo A. R. Silva" , Kalle Valo , "David S. Miller" References: <20181005184245.GA11700@embeddedor.com> Cc: ath10k@lists.infradead.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org From: Ben Greear Organization: Candela Technologies Message-ID: <3a55bec6-d20d-f500-e741-b228a86b7117@candelatech.com> Date: Fri, 5 Oct 2018 12:09:50 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.0 MIME-Version: 1.0 In-Reply-To: <20181005184245.GA11700@embeddedor.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/05/2018 11:42 AM, Gustavo A. R. Silva wrote: > Currently, the error handling for the call to function > ath10k_get_legacy_rate_idx() doesn't work because > *rate_idx* is of type u8 (8 bits, unsigned), which > makes it impossible for it to hold a value less > than 0. > > Fix this by changing the type of variable *rate_idx* > to s8 (8 bits, signed). There are more than 127 rates, are you sure this is doing what you want? Thanks, Ben > > Addresses-Coverity-ID: 1473914 ("Unsigned compared against 0") > Fixes: 0189dbd71cbd ("ath10k: get the legacy rate index to update the txrate table") > Signed-off-by: Gustavo A. R. Silva > --- > drivers/net/wireless/ath/ath10k/htt_rx.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c > index f240525..edd0e74 100644 > --- a/drivers/net/wireless/ath/ath10k/htt_rx.c > +++ b/drivers/net/wireless/ath/ath10k/htt_rx.c > @@ -2753,7 +2753,8 @@ ath10k_update_per_peer_tx_stats(struct ath10k *ar, > struct ath10k_per_peer_tx_stats *peer_stats) > { > struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv; > - u8 rate = 0, rate_idx = 0, sgi; > + u8 rate = 0, sgi; > + s8 rate_idx = 0; > struct rate_info txrate; > > lockdep_assert_held(&ar->data_lock); > -- Ben Greear Candela Technologies Inc http://www.candelatech.com