Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp979921ybh; Sat, 3 Aug 2019 14:44:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqxNND2F/f2k4atg/h4AAyMFPaSaiOp9A4UPzp1hGR/ZdNBWp8gyLdlVAk4RsXYU8lf739aT X-Received: by 2002:a17:902:20e9:: with SMTP id v38mr41107318plg.62.1564868644329; Sat, 03 Aug 2019 14:44:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564868644; cv=none; d=google.com; s=arc-20160816; b=vvGgTHIGO9jjPJ1Z5O9aH3qedwjlPdBk99BztGxy2EBzFGbvIJGbui0crVtj4gbm+h OheomYer4Bku+ZWw/7BEbl+oxMWjZg0jqnAiFn/I/cuBnTuRb3V5o3k+jcqBL5mhhM0P RzjETOdQNqkdsYsY4A8wUq/LMZwORXN8ZcNWk1yn3agbAYwgj40gSwLR8Qdbef9SG1+e oxDG6tdsdfPq67xCeSJbFLcOWiHQtNEdG9TlcideK+TD3aBPBWtS8Mv6ELhIgX87Jr8S 7ZSl/EAtOTm7Zq55ANDqvLMXc/1MvZdCZjVSepTH4esncn1WsIzH37C7zGhmIJ/CFlk7 n5sQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=qNNPwIg3Aybl8pkZAf99Y6nIkQs8R48D2APc/zeukwo=; b=AjX77NL7A6gSfNvNicUFobP5mQXBHqBQDekxUGav9aN9ipfqxvjNEYo4sOuv2d7Hlw IlItmeLMg4ZqWKElWc8wOW4TuxiXuXZv/+9G6jZ7RK8IENwd05EvOXbk1LKBayA7xS3r izsexqyKux6a56kEUV2k/PkX+KDGurBPRWEmHqEcrFOi531tJ1UXHMPaCpcl3ZYEEsH7 N8rI5jInHIZoIzWBL3tCgaMkSM7OJ8FXkM11W7lE7qufqyYLnLoJtuEBX+8gW/sDjeeI d5FIhfib/DUOTE/jdKhyJLbXpjnzt5gs6OmB3YLLvtzPPta349/cbv5yUD3QnIRP4yMK 6f6w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l36si14809342pgb.292.2019.08.03.14.43.48; Sat, 03 Aug 2019 14:44:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733190AbfHBPwX (ORCPT + 99 others); Fri, 2 Aug 2019 11:52:23 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:58130 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728853AbfHBPwW (ORCPT ); Fri, 2 Aug 2019 11:52:22 -0400 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1htZqr-0002xO-Hi; Fri, 02 Aug 2019 15:52:17 +0000 From: Colin King To: Jeff Kirsher , "David S . Miller" , intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH][net-next] ice: fix potential infinite loop Date: Fri, 2 Aug 2019 16:52:17 +0100 Message-Id: <20190802155217.16996-1-colin.king@canonical.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Colin Ian King The loop counter of a for-loop is a u8 however this is being compared to an int upper bound and this can lead to an infinite loop if the upper bound is greater than 255 since the loop counter will wrap back to zero. Fix this potential issue by making the loop counter an int. Addresses-Coverity: ("Infinite loop") Fixes: c7aeb4d1b9bf ("ice: Disable VFs until reset is completed") Signed-off-by: Colin Ian King --- drivers/net/ethernet/intel/ice/ice_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c index c26e6a102dac..088543d50095 100644 --- a/drivers/net/ethernet/intel/ice/ice_main.c +++ b/drivers/net/ethernet/intel/ice/ice_main.c @@ -488,7 +488,7 @@ static void ice_prepare_for_reset(struct ice_pf *pf) { struct ice_hw *hw = &pf->hw; - u8 i; + int i; /* already prepared for reset */ if (test_bit(__ICE_PREPARED_FOR_RESET, pf->state)) -- 2.20.1