Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp340229pxj; Thu, 20 May 2021 10:30:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzZVgyC88tZ5Im5p9nZm5qPGj/6Ti6sic0CizgtyMr38tHDJ522ESJbllbXR5tv6p4jqx8j X-Received: by 2002:a17:906:d8cb:: with SMTP id re11mr5834277ejb.482.1621531816725; Thu, 20 May 2021 10:30:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621531816; cv=none; d=google.com; s=arc-20160816; b=SACF+iaXrgPoBmo/GFBNRRMnhsSyEtEIwrgoZCT5iEnTlcK3aTadGHwZ4MhWeKP9gB Xw9DT8E8LwvGDJAQ+T9UsByoyZvqqyCGKYsnOTApbFZpA9Eamgbk4SKHcYBc7vaKNRFm Q5CWwzUHZN9DXmhHIV1958tP2WsidUjYuP5qGhXuNDX95TMdY0gR3/vz9weJqCml8CKD 6pXImk2zoaF+qsjdm1v2289DiToxdwIky+Gx1B+omNFnC3KlNVJbgExWq+dKJe0da9L6 AYkFnTmHCEsYQr8rHXEbzP6EM7prXw5xS3nY4sFaF/0LqqmCHHUDFlALG/X5kz1/YVdG LOCw== 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=v41S+yO5f8cqwcG5yAkTycD8+42V8tytpYvBF+6DzWg=; b=ToMGf95TH9618McJ8bN+qMyka6waL94uStrhX6OS03NDaM4il23Kb2gJbArTsgssi7 qdyfP6seNnP+li22dG0CuLGZpPzL/JVWmMs6US9yswGHIPQ8y3N5CKOSADpulvASlsTm +iPuf7I8bRq0xrOCMBrlO0MDKUJnVk/dwwcMrYhrpUT0gHVhwmwIwIIAt6t24dwRHQQf +buLJstA8RzjiFqTRkpShi90z5vMEQ2scQ5/4nOd8mUYuJOM+o+j47CLLF8vessGY3vh LeSv7fEwG3/3lZdym7Baco5oteWcweACpMI2mojSn/gzz1fNPxHGPAA9wxGqVqMiwZ64 wpew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WVCTWENG; 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 y16si2670439edr.498.2021.05.20.10.29.51; Thu, 20 May 2021 10:30:16 -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=WVCTWENG; 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 S234370AbhETJ4o (ORCPT + 99 others); Thu, 20 May 2021 05:56:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:54976 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234163AbhETJxR (ORCPT ); Thu, 20 May 2021 05:53:17 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 60AC261613; Thu, 20 May 2021 09:36:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621503389; bh=whTy+6IKoyMJDxSrO+ikP2QAJGMcfSCCcD8EJ+0VVHU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WVCTWENGr0mGx8f+5uC5len8gwiyg8YTMOoNV5mQ2EvKsMbtKK7CL9zACnM+SSurD 1Xefe92vOVl6eEJIWdw1CGmqDb69wGwKGiMORa0j4p+7KyBw0o/omneR0XZF8+p9n+ CUSgCTFDME7IE49gnDkR32WHhYqa4xfdzhfcoVxk= 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.19 199/425] staging: rtl8192u: Fix potential infinite loop Date: Thu, 20 May 2021 11:19:28 +0200 Message-Id: <20210520092137.957659780@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092131.308959589@linuxfoundation.org> References: <20210520092131.308959589@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 87244a208976..cc12e6c36fed 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -3379,7 +3379,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