Received: by 2002:a05:6520:4211:b029:f4:110d:56bc with SMTP id o17csp2114272lkv; Thu, 20 May 2021 03:44:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxfzrHzairp97zBgE45d2TtMrgrRrLuJcXK3N43heXO31uHhvWz0vhhv6/mjJDPFA8G6/eY X-Received: by 2002:a92:cec5:: with SMTP id z5mr4454155ilq.110.1621507483910; Thu, 20 May 2021 03:44:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621507483; cv=none; d=google.com; s=arc-20160816; b=GVFtCjSrso22oi9kVunb+XSBx/HWMc0HNxELQPeubR/6Y+ROZnYGCejvexZVuzS982 P08LJ+niPbfaXh0BCGcL8+Q137NUMpwB0mWE7C0J5ts8mQCjMeSnAhh3GJPpPRaEGJsy Yke8qLAm6uPmXLHUrAbJw0jIqEkzSicsyUf4i+HF8o+QfLTh4WTyakM+WZApd6BwqAlb ysqdHqm2MZWujHE67L5v+8urw37QMsqmPlTuFLEh8/gi1oZLTL1xq1CffjcfK2wqLn3k nQQxQfBKfW3nw53REMW2BUyHdy6draeNKDNNA/45uO6e2L5CA2Kx4Y3r2cFRznpbpmWp wu8w== 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=d+Mvg2iZuVj1lQN8jsXMB0ZyR/v+SPZPwJd0jryYgiY=; b=xm6w634wBJ9+wvXkHLaeRNpbkovCe+NlPqcDIKAgrbfbSDJfEkhEoQMhtjaFrYLv2/ R1YRAdMwa0mxjsaTAGFVUOQITUpA0vRiggaH360l8ZliNMZ6MmffX68Ld2RatXqL2Gy+ WVr6S0vYm4mUM4L6K/h1N5ezueK72bO+xXvGi+7My1ROP9SgnplLxLSdm0YyAAuWnPdb aF+vZ4la3GecYtzckgNKKdgO1zLPqMBFsfuEcoHSNKqFPCxYrrobaKsfohb7UZ22HZDX txZS3QexpZKp5ivx5t9WzHgcIiTiWW304Q933aGmEsR2Wscfz9FuCyA01xXmWjwcRjv1 7jSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DbLpQLUa; 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 b26si1946688ios.29.2021.05.20.03.44.15; Thu, 20 May 2021 03:44:43 -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=DbLpQLUa; 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 S237785AbhETKna (ORCPT + 99 others); Thu, 20 May 2021 06:43:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:55802 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236818AbhETK21 (ORCPT ); Thu, 20 May 2021 06:28:27 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1FD1561C33; Thu, 20 May 2021 09:50:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621504259; bh=2kfCO7LXG39FlNWL8826sbcj1qX6DzeJ2z1Uf48pomU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DbLpQLUaNkHQwmmhiudNW8LnW7v8rxXGHIhPTHM1TVkjR1+pqgAjWfvnW8Da/6FQl Bnz0//TORhknHikmgB7UBN/pElyDjHqPEsquhZY00H2ICgnOlgdKvaSrm9rTFTSyhf p8bB7keP2OGpl50h1O2naIQfXjVOOUwCDNj7FmKA= 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.14 163/323] staging: rtl8192u: Fix potential infinite loop Date: Thu, 20 May 2021 11:20:55 +0200 Message-Id: <20210520092125.691185703@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092120.115153432@linuxfoundation.org> References: <20210520092120.115153432@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 b5941ae410d9..89ec4bb19e48 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