From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 00DEAA046B for ; Tue, 23 Jul 2019 11:13:49 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D15B91BFD6; Tue, 23 Jul 2019 11:13:49 +0200 (CEST) Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [67.231.154.164]) by dpdk.org (Postfix) with ESMTP id 11C0A1BFC5; Tue, 23 Jul 2019 11:13:46 +0200 (CEST) X-Virus-Scanned: Proofpoint Essentials engine Received: from webmail.solarflare.com (webmail.solarflare.com [12.187.104.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mx1-us2.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id 10CFD80057; Tue, 23 Jul 2019 09:13:45 +0000 (UTC) Received: from ocex03.SolarFlarecom.com (10.20.40.36) by ocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 23 Jul 2019 02:13:41 -0700 Received: from opal.uk.solarflarecom.com (10.17.10.1) by ocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server (TLS) id 15.0.1395.4 via Frontend Transport; Tue, 23 Jul 2019 02:13:41 -0700 Received: from ukv-loginhost.uk.solarflarecom.com (ukv-loginhost.uk.solarflarecom.com [10.17.10.39]) by opal.uk.solarflarecom.com (8.13.8/8.13.8) with ESMTP id x6N9DenG032610; Tue, 23 Jul 2019 10:13:40 +0100 Received: from ukv-loginhost.uk.solarflarecom.com (localhost [127.0.0.1]) by ukv-loginhost.uk.solarflarecom.com (Postfix) with ESMTP id A50461613C3; Tue, 23 Jul 2019 10:13:40 +0100 (BST) From: Andrew Rybchenko To: Thomas Monjalon , Ferruh Yigit CC: , Date: Tue, 23 Jul 2019 10:13:28 +0100 Message-ID: <1563873208-5096-1-git-send-email-arybchenko@solarflare.com> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 Content-Type: text/plain X-TM-AS-Product-Ver: SMEX-12.5.0.1300-8.5.1010-24788.002 X-TM-AS-Result: No-3.286300-4.000000-10 X-TMASE-MatchedRID: G57QZ6a/I4GID0Lqh6RYhIph1hAtvKZNWDLajM22ETYELMPQNzyJS4GV P6OXoWth5ad5nuEAiDyqKuQTxuBXaCxppiUy9o4cA9lly13c/gGiIpNv3rjMdSOjUj3t9SaI8Sr PK0b+HrHi8zVgXoAltsIJ+4gwXrEtWBd6ltyXuvvpDis/Nf7dOE/UwTTy1VyUbFqT1VhAE7jpAO UWGk85rS14M4WV46Pu0WiTjkVrIU9tUxSFp4ZjSSl8sowbi5lrHyTMqtUzTBK9Tbikt9AWZ0CBS GS7bIBtA1B/p1SzcogrKiD/U8b7SaNbPJBuvLaLftwZ3X11IV0= X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10-3.286300-4.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.5.1010-24788.002 X-MDID: 1563873225-UUYuEwyGKLw5 Subject: [dpdk-stable] [PATCH] ethdev: avoid usage of uninit device info in bad port case X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" rte_eth_dev_info_get() returns void and caller does know if the function does its job or not. Changing of the return value to int would be API/ABI breakage which requires deprecation process and cannot be backported to stable branches. For now, make sure that device info is initialized even in the case of invalid port ID. Fixes: a30268e9a2d0 ("ethdev: reset whole dev info structure before filling") Cc: stable@dpdk.org Signed-off-by: Andrew Rybchenko --- lib/librte_ethdev/rte_ethdev.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c index 64191737c..97b093edc 100644 --- a/lib/librte_ethdev/rte_ethdev.c +++ b/lib/librte_ethdev/rte_ethdev.c @@ -2552,10 +2552,11 @@ rte_eth_dev_info_get(uint16_t port_id, struct rte_eth_dev_info *dev_info) .nb_mtu_seg_max = UINT16_MAX, }; + memset(dev_info, 0, sizeof(struct rte_eth_dev_info)); + RTE_ETH_VALID_PORTID_OR_RET(port_id); dev = &rte_eth_devices[port_id]; - memset(dev_info, 0, sizeof(struct rte_eth_dev_info)); dev_info->rx_desc_lim = lim; dev_info->tx_desc_lim = lim; dev_info->device = dev->device; -- 2.17.1