Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4597198pxj; Wed, 12 May 2021 08:57:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzav4qT0RaxKIUtR5GRbE70Tjhe653FPa4mM02myD1ET1ZhRn4z+xV5LBPI1DI0nX/P8cNU X-Received: by 2002:a05:6402:1256:: with SMTP id l22mr8977939edw.207.1620835052012; Wed, 12 May 2021 08:57:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620835052; cv=none; d=google.com; s=arc-20160816; b=lFcumWvnLpddnDjluKXZltnnhhBSY0urS44uV5tLoedW9KDNg9wdVKTBrrpIH45r7U wXKNYy8yDnCOp9Dpliz/DOEL6ba2Q4lvITOTGRkUUPt1mSlZfj3KEf5i/HVjJorwCLBI J3+9Dow0CQyLj75nI7BdzSZGFMSdQiLrU4Q+j2XLo5TvP2G7oOI+7GxIr8viTdFwHS6X N3nPvexOJZEcfcq4U7mvOWqRxEa+2LCIvb5JbE5bhOROWOuPSzU/l5r9ITE5TdmXv3rN QJxBpG20TaGa2+O73iS2EoJ4M3G4qVcs8zBp61snlqduURmWQbjR1y4fbEhtSVVqKjgb 0lfA== 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=t2SOUTqByPZtaCCOsHXLVecpe0Qae7oJsYIFfJCMoxw=; b=jV8/I9HrvFMGhz+5kfpWaBTIridqRWKtLz6yGrQAdqSc9f63Jd9lA2ebAa9G5mJX3t b5AW8hBWn2KheS42MEt5mRGneU61XxVGOrojIozN6uLELzU1j2Rj3mglXuMhcLUDK7eA oM4j7kdhm3Hse1qlvoK71lBQ37mB6dNJgzqMm/HWkEfliDalEaQjeWPY6e4Kgro3jE1a 8SgtHVgOQLBDtgZ/h00mquReK0RVMnJ3d/gve+NngvF3YRmy49e4jp8+uvGgP2zia15h KshPlONiH/qE0BOFF4TDBbfJVDHQO247AMJ4DGQJyaxQW4DRhZ7yu+G7mDsSfmUuRsao PxHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HS9vM77J; 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 qq28si297754ejb.308.2021.05.12.08.57.07; Wed, 12 May 2021 08:57:32 -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=HS9vM77J; 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 S233681AbhELPx4 (ORCPT + 99 others); Wed, 12 May 2021 11:53:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:39078 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234944AbhELPZ5 (ORCPT ); Wed, 12 May 2021 11:25:57 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 06BE4616EA; Wed, 12 May 2021 15:11:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620832271; bh=WuOQHRnDD8ShUBX5XoH5eiTqprtZpJ4cbZQO17KoFcA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HS9vM77J7x0NWu78rZp4gZTiWI5pTXPsBimP4coZa9q0JY2ekfzOmwuB3kT0rkSGI LHpFmLws2OHHxVzr7Ofnw7YjPlxSDRffybPVcBicjVHkTY3z9wFjHYH2AR5zPDRsjm kIc/d8l+VdpWXNmRA765A/cmmkpFqIqell5gnfww= 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 5.10 210/530] staging: rtl8192u: Fix potential infinite loop Date: Wed, 12 May 2021 16:45:20 +0200 Message-Id: <20210512144826.741522029@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210512144819.664462530@linuxfoundation.org> References: <20210512144819.664462530@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 27dc181c4c9b..03d31e52b399 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -3208,7 +3208,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