Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp63938pxj; Thu, 20 May 2021 04:39:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxCSJgdxWETnQA0FWPAKhS9gLTXIIJTivAuHSmKe9ygvGXgVo2IOmG++CF7+ppELmCuxz/0 X-Received: by 2002:a17:906:1dc5:: with SMTP id v5mr1401105ejh.212.1621510799166; Thu, 20 May 2021 04:39:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621510799; cv=none; d=google.com; s=arc-20160816; b=xS3Ue/n+aBRNmWTi3gvMI9TKNBu5jKjFy43giSlrJ1OFstqdBBdDfUH2IUtaJYnUGd D7KeFoz5OAqQTnodpxNa7jFOWho0/QkQV11TmMHCbjV0LFMZGIfKaBlAkxpjM94EONrh yeDXcp/ox93Vv+BN3zSZOLrtMDdawvv9lOPwe2ExHQdTpADJhJ+bry+E2ZVA408mhUm1 FN5s4CvZy1CYHU6yjxhUhtqiis4Jg+ze7ioviuKQkPrKuMfmLK8GESaUV2Bnl//BPllJ I6fjHzzJYCs+JK4rRrU6gKtrWD/C2h0eA7sWWf7WEMtAjzIqbhzNXzBlqMXsPlOMVO1R Z4kA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=yyzgsXlTaIXldoQ9JXs3gFSF3urJG5KMMuLGXjL+Rrg=; b=OQwkjPBigyYalVGRzzDYpqSZHsVsDOklW6EOAej5ba/mJtZ9ZtY67ZlDhWIAoit2iY TUEQT9n6sKKjPBkCGpzwkel44YuZeb2YICb2cAd5N21U0XkSLAYiXCW6FmBhiBUN7E9y 72cH0dpHSVPe4OCEjVABtph76F9O88yGWM7twtszMfOy3guc9PAfUIVc6bNMaM+unqaq 3uo/Ig1srK/j3yDRXyYWykFujc1xf7haCnwIoovM3bOTLawRkeEiA9HaoYkvrcrumWuC MGY2OCArSu41KYPMYQNwx5VeiLgBahjzkbl9/aTNIP9c6Wgeqnr3M/NP7YP/94CAFn8K mRAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZbsVewaJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 a5si2081855edq.133.2021.05.20.04.39.14; Thu, 20 May 2021 04:39:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=ZbsVewaJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 S242491AbhETLfb (ORCPT + 99 others); Thu, 20 May 2021 07:35:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:37990 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238612AbhETLPM (ORCPT ); Thu, 20 May 2021 07:15:12 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B069261D5C; Thu, 20 May 2021 10:08:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621505340; bh=t4XaliKOt2XlK6EB741wYuZCHq9e08TmshK17TBViBU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZbsVewaJXucxYE20vs5zwnkW03rdjrKKWP7Q6NlGgmXdub684MVgEahJXKVZZQ0S8 Xd+sSIX07jqQC7OlxVwm19zkrutnjYRQ9gJ/NRKxGglEcK9+R17z4WeoiE+7q+y+2L 1xJL7xQ3cNpVWO++ohp7Tlo6eufWuCxVs8voFaXg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Colin Ian King , Sasha Levin Subject: [PATCH 4.4 091/190] staging: rtl8192u: Fix potential infinite loop Date: Thu, 20 May 2021 11:22:35 +0200 Message-Id: <20210520092105.216799095@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092102.149300807@linuxfoundation.org> References: <20210520092102.149300807@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Colin Ian King [ Upstream commit f9b9263a25dc3d2eaaa829e207434db6951ca7bc ] The for-loop iterates with a u8 loop counter i and compares this with the loop upper limit of riv->ieee80211->LinkDetectInfo.SlotNum that is a u16 type. There is a potential infinite loop if SlotNum is larger than the u8 loop counter. Fix this by making the loop counter the same type as SlotNum. Addresses-Coverity: ("Infinite loop") Fixes: 8fc8598e61f6 ("Staging: Added Realtek rtl8192u driver to staging") Signed-off-by: Colin Ian King Link: https://lore.kernel.org/r/20210407150308.496623-1-colin.king@canonical.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/staging/rtl8192u/r8192U_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index 1e0d2a33787e..72dabbf19bc7 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -3418,7 +3418,7 @@ static void rtl819x_update_rxcounts(struct r8192_priv *priv, u32 *TotalRxBcnNum, u32 *TotalRxDataNum) { u16 SlotIndex; - u8 i; + u16 i; *TotalRxBcnNum = 0; *TotalRxDataNum = 0; -- 2.30.2