From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <stable-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id ED178A0553
	for <public@inbox.dpdk.org>; Mon, 17 Feb 2020 18:46:00 +0100 (CET)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id E5BEC1DAA8;
	Mon, 17 Feb 2020 18:46:00 +0100 (CET)
Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com
 [209.85.128.48]) by dpdk.org (Postfix) with ESMTP id ACEAA1DAA0
 for <stable@dpdk.org>; Mon, 17 Feb 2020 18:45:58 +0100 (CET)
Received: by mail-wm1-f48.google.com with SMTP id p17so196596wma.1
 for <stable@dpdk.org>; Mon, 17 Feb 2020 09:45:58 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:date:message-id:in-reply-to:references
 :mime-version:content-transfer-encoding;
 bh=MqT69xKvW1BTJQxZj02r9Bf/MILik5sixl/mS2iA7n8=;
 b=Ajg9ljSUrnaDkhdXeQWvsfMA7lb52qhbpCRk9UFBfYn/gtI3/NnWMpcYltMU/4kcTg
 1IA0z//ji7DZ3pM3TFMszfBAGJCqljGBqocFed0Jk1rPeuCCfS/ZIhaiRoIlLWiyctxv
 icveKewwm5Ls7cus3wcZqd1tmGFjDqcMB7Txg7RPzPXoeYSq1laZenF9CAP1b2qO3LKn
 wIL6vJYXaW3yw0vtgJeH4G+OGK30L7JMst9iblRTmvdV6MKiLYhAWTuKumhjA5LyoYP5
 QZHW4COGF6fZ5qsD30ZRhPcdTY1K7mM3ueiPTmEGqshAczEnOfU+fPmPFcMegD3voq4l
 h9mw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=MqT69xKvW1BTJQxZj02r9Bf/MILik5sixl/mS2iA7n8=;
 b=esmZEd5Coa3RPiHFqbagOQILKwsFXNTlH3vR4VP8XIhBcbMq6x8nKRO4/wszxlJvdJ
 lvDmhrB+VbWPOkzKoPPlNWy4VZAUVFvoSyvRKS+NtvF/uElvY8PR59cxi0XGuuHFzbxC
 PdwtV/vRXAuCq/o4/QLxfoyqVdWeA3p88N7g1L3WKSaHOjWeVGUhcxKsJC4YUNsAcJBE
 ASGHJ1aGB7CLymDde9DHVZMDDtkPRJcmD89V5Bfg7/VxekTCeoNtmxZbl9quiKOipt3O
 KvrdJh0b6n/MixfuQuiw3cfdyjlSUSraID62RTsYmwTKmGz+bvLJtUOR1KsFOG/JwCfi
 2HAQ==
X-Gm-Message-State: APjAAAXSoLhOwEqrRHqW2tFafDx3B1oTsB5tiayXhU5TOG0ckqQNpEVs
 2kuAfkuWGL/EmiCL1ac5wps=
X-Google-Smtp-Source: APXvYqzWaZCsm3esLIw3aP9qZCeLaj5+uFziRPGcr1dmY33E1a86dHMRYrvbrUIv1Lbh3sY3NIRQSg==
X-Received: by 2002:a1c:dfd6:: with SMTP id w205mr131183wmg.151.1581961558438; 
 Mon, 17 Feb 2020 09:45:58 -0800 (PST)
Received: from localhost (userh634.uk.uudial.com. [194.69.103.7])
 by smtp.gmail.com with ESMTPSA id y185sm238284wmg.2.2020.02.17.09.45.57
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 17 Feb 2020 09:45:57 -0800 (PST)
From: luca.boccassi@gmail.com
To: Ciara Power <ciara.power@intel.com>
Cc: Bruce Richardson <bruce.richardson@intel.com>,
 dpdk stable <stable@dpdk.org>
Date: Mon, 17 Feb 2020 17:44:57 +0000
Message-Id: <20200217174546.25334-5-luca.boccassi@gmail.com>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20200217174546.25334-1-luca.boccassi@gmail.com>
References: <20200211112216.3929-190-luca.boccassi@gmail.com>
 <20200217174546.25334-1-luca.boccassi@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Subject: [dpdk-stable] patch 'examples/ioat: fix invalid link status check'
	has been queued to stable release 19.11.1
X-BeenThere: stable@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches for DPDK stable branches <stable.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/stable>,
 <mailto:stable-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/stable/>
List-Post: <mailto:stable@dpdk.org>
List-Help: <mailto:stable-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/stable>,
 <mailto:stable-request@dpdk.org?subject=subscribe>
Errors-To: stable-bounces@dpdk.org
Sender: "stable" <stable-bounces@dpdk.org>

Hi,

FYI, your patch has been queued to stable release 19.11.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 02/19/20. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Thanks.

Luca Boccassi

---
>From 87eb3209962373df52201e3805f68c5a886b57f4 Mon Sep 17 00:00:00 2001
From: Ciara Power <ciara.power@intel.com>
Date: Fri, 7 Feb 2020 10:24:02 +0000
Subject: [PATCH] examples/ioat: fix invalid link status check

[ upstream commit 2582bb980d287b05f378e5a4a467f217a5d63926 ]

The return value of the get link function call was not checked, and
could return a negative value indicating a failure. This meant the
link_status of the link being checked is invalid, because the link was
not filled with data. The return value is now checked, and if the return
value is not 0 for success, the loop continues with the next port.

To avoid confusion between variable names, the existing retval variable
is renamed to link_status, to better represent its use.

Coverity issue: 350348
Fixes: c8e6ceecebc1 ("examples/ioat: add new sample app for ioat driver")

Signed-off-by: Ciara Power <ciara.power@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
 examples/ioat/ioatfwd.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/examples/ioat/ioatfwd.c b/examples/ioat/ioatfwd.c
index 8a6076828d..7255ff3c9e 100644
--- a/examples/ioat/ioatfwd.c
+++ b/examples/ioat/ioatfwd.c
@@ -697,7 +697,7 @@ check_link_status(uint32_t port_mask)
 {
 	uint16_t portid;
 	struct rte_eth_link link;
-	int retval = 0;
+	int ret, link_status = 0;
 
 	printf("\nChecking link status\n");
 	RTE_ETH_FOREACH_DEV(portid) {
@@ -705,7 +705,12 @@ check_link_status(uint32_t port_mask)
 			continue;
 
 		memset(&link, 0, sizeof(link));
-		rte_eth_link_get(portid, &link);
+		ret = rte_eth_link_get(portid, &link);
+		if (ret < 0) {
+			printf("Port %u link get failed: err=%d\n",
+					portid, ret);
+			continue;
+		}
 
 		/* Print link status */
 		if (link.link_status) {
@@ -714,11 +719,11 @@ check_link_status(uint32_t port_mask)
 				portid, link.link_speed,
 				(link.link_duplex == ETH_LINK_FULL_DUPLEX) ?
 				("full-duplex") : ("half-duplex\n"));
-			retval = 1;
+			link_status = 1;
 		} else
 			printf("Port %d Link Down\n", portid);
 	}
-	return retval;
+	return link_status;
 }
 
 static void
-- 
2.20.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2020-02-17 17:00:15.503431407 +0000
+++ 0005-examples-ioat-fix-invalid-link-status-check.patch	2020-02-17 17:00:15.267949888 +0000
@@ -1,8 +1,10 @@
-From 2582bb980d287b05f378e5a4a467f217a5d63926 Mon Sep 17 00:00:00 2001
+From 87eb3209962373df52201e3805f68c5a886b57f4 Mon Sep 17 00:00:00 2001
 From: Ciara Power <ciara.power@intel.com>
 Date: Fri, 7 Feb 2020 10:24:02 +0000
 Subject: [PATCH] examples/ioat: fix invalid link status check
 
+[ upstream commit 2582bb980d287b05f378e5a4a467f217a5d63926 ]
+
 The return value of the get link function call was not checked, and
 could return a negative value indicating a failure. This meant the
 link_status of the link being checked is invalid, because the link was
@@ -14,7 +16,6 @@
 
 Coverity issue: 350348
 Fixes: c8e6ceecebc1 ("examples/ioat: add new sample app for ioat driver")
-Cc: stable@dpdk.org
 
 Signed-off-by: Ciara Power <ciara.power@intel.com>
 Acked-by: Bruce Richardson <bruce.richardson@intel.com>