Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp3239234pxv; Sun, 4 Jul 2021 12:08:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJww6DhIklOz1VxileNGbqr8yPFDUGldF6GFMlo01XYY94OXGFUFRbx0lMwbmGAFqsdxBc4Y X-Received: by 2002:a5d:904c:: with SMTP id v12mr8824683ioq.95.1625425719459; Sun, 04 Jul 2021 12:08:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625425719; cv=none; d=google.com; s=arc-20160816; b=nlljW0H3vSe2+dfzsV99ZUedW6AZ2XwdA4/INiFGtI0cU9rn8jUG7Bf7/HKVl/817l RezAg8/jc+1ziEAMc23FYRaLZS5xsFRK11/VyvnkKlJIagGRy86ERKnLrGAQnblFsLww JFPtpAC43pI0ilXISgWjxe0OD0f6aIxULTdeIttb5dnR4WLlm6LT1vYgY8e4GXUGPg+X dpfGaFCX8neNA/VJyf0K063Q3EcH7jkrFUTRCryB1eR/Fnl5x6zuilSolKzIfjMP+LO5 aEE7DuWkT/stKdbu8pvnmZgqGqf+7yXupYgn2OiH+7gCFDNI6HHE57Ym4j9y/jJRZL4f GX6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=tVItoAlZ2+biqQCNo9R9HyiouCQ0kQOGoJD1czkUV70=; b=PdAJZ2SN57z+oa3NJFztOsoE/UlNYT8CA3O3DuqgBkSXypUrDHUZSPj3TGfsjf36Jv 0GBvjAgTJsPuh17XQh/FwDN/Vb9F4R2ZA7+Luorlty4JnD1LNlIU5u7W2VyUE4GGV7pC RpWvUZj3HhHty0dChK7zNJTe5QEUHlVrYg4oHAKEAh2+R5R23n223OBLn+nTL3TyeClK ngE/upmExQPr+A7nAlyYfslUsJt0I/jWTgEt/jh9io+ogf6fteFd/Hm2o06RXYNLQljn YEHrWvOgc0sh+J5GZocLywT3bLJBxJ/D9CFJ2aRckfg1Gz/zdePH3miEJu3e2clokHae OKGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qiTAXYmD; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x5si11900318jas.126.2021.07.04.12.08.24; Sun, 04 Jul 2021 12:08:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qiTAXYmD; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229743AbhGDTKz (ORCPT + 99 others); Sun, 4 Jul 2021 15:10:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:46716 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229724AbhGDTKy (ORCPT ); Sun, 4 Jul 2021 15:10:54 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 88470613E2; Sun, 4 Jul 2021 19:08:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1625425699; bh=VLiKGR1v+9NnuwU1LjnHuZ6Su0GWomCpRT6OA2j6uFw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=qiTAXYmDvRFSZ4zinz8MPMNQnVXr4AtbiXkUHkBDWjOEGJ+slrPQMfdzp6h7mX+Ao KADweRq9ekxgcqmCe2PhV4qQV1cKm/qgHZXfChr9CcUjmBenf4z+teDmOIf4zX8j9S 919rdrq7H8t0db/BiLYpq3pf4GVvdnOh6m4eaoZc= Date: Sun, 4 Jul 2021 21:08:16 +0200 From: Greg KH To: John Wood Cc: Felix Fietkau , Lorenzo Bianconi , Ryder Lee , Kalle Valo , "David S. Miller" , Jakub Kicinski , Matthias Brugger , Shayne Chen , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH v2] mt76/mt7915: Fix unsigned compared against zero Message-ID: References: <20210704145920.24899-1-john.wood@gmx.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210704145920.24899-1-john.wood@gmx.com> Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On Sun, Jul 04, 2021 at 04:59:20PM +0200, John Wood wrote: > The mt7915_dpd_freq_idx() function can return a negative value but this > value is assigned to an unsigned variable named idx. Then, the code > tests if this variable is less than zero. This can never happen with an > unsigned type. > > So, change the idx type to a signed one. > > Addresses-Coverity-ID: 1484753 ("Unsigned compared against 0") > Fixes: 495184ac91bb8 ("mt76: mt7915: add support for applying pre-calibration data") > Signed-off-by: John Wood > --- > Changelog v1 -> v2 > - Add Cc to stable@vger.kernel.org > > drivers/net/wireless/mediatek/mt76/mt7915/mcu.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c > index b3f14ff67c5a..764f25a828fa 100644 > --- a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c > +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c > @@ -3440,8 +3440,9 @@ int mt7915_mcu_apply_tx_dpd(struct mt7915_phy *phy) > { > struct mt7915_dev *dev = phy->dev; > struct cfg80211_chan_def *chandef = &phy->mt76->chandef; > - u16 total = 2, idx, center_freq = chandef->center_freq1; > + u16 total = 2, center_freq = chandef->center_freq1; > u8 *cal = dev->cal, *eep = dev->mt76.eeprom.data; > + int idx; > > if (!(eep[MT_EE_DO_PRE_CAL] & MT_EE_WIFI_CAL_DPD)) > return 0; > -- > 2.25.1 > This is not the correct way to submit patches for inclusion in the stable kernel tree. Please read: https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html for how to do this properly.