From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A6058A0582; Tue, 22 Nov 2022 16:31:04 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E040442D75; Tue, 22 Nov 2022 16:30:59 +0100 (CET) Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by mails.dpdk.org (Postfix) with ESMTP id D0C7342D70 for ; Tue, 22 Nov 2022 16:30:57 +0100 (CET) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A2202B81BE7 for ; Tue, 22 Nov 2022 15:30:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 32A23C433C1; Tue, 22 Nov 2022 15:30:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669131056; bh=RgYWMx2bXw0Kf6OSgrUuQ2FaHKOsqLyY7fKYUDdVLR4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E179EaF4CvEGwPfton6oczRuDns1g2YzlJ41ak7AnoretaekyNnoZNmv/K5YifFaX JlG/WvlDT19Rsd6f+XJFWNobimRZuKyZFD97kGZOsTmEQSTUVXqs9EiOeN6fK3xIeQ ZjI+0hBkUSS3JRT911ww5rCD3J9L03HWdkmnagFivkzbKRUcNnYuaflLaBXAe6hXy3 gN28ravZ/X2M2NJAvEynQi4T9V64IzdUomv2ZL53MtcdOMkvq/9U8BL0D41dl9WWWy 2m6C2XJAyKtWvo1jzHcgkB+jYvVq9+IMXhGXelnZ1JnmC4PcPxmmHYwkCDn/k68yEy AUGT+nci8qErA== From: okaya@kernel.org To: dev@dpdk.org Cc: Sinan Kaya Subject: [PATCH RESEND v2 01/11] ethdev: check return result of rte_eth_dev_info_get Date: Tue, 22 Nov 2022 10:30:43 -0500 Message-Id: <20221122153053.1172434-2-okaya@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221122153053.1172434-1-okaya@kernel.org> References: <20221122153053.1172434-1-okaya@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Sinan Kaya rte_class_eth: eth_mac_cmp: The status of this call to rte_eth_dev_info_get is not checked, potentially leaving dev_info uninitialized. Signed-off-by: Sinan Kaya --- lib/ethdev/rte_class_eth.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/ethdev/rte_class_eth.c b/lib/ethdev/rte_class_eth.c index 838b3a8f9f..8165e5adc0 100644 --- a/lib/ethdev/rte_class_eth.c +++ b/lib/ethdev/rte_class_eth.c @@ -51,7 +51,9 @@ eth_mac_cmp(const char *key __rte_unused, return -1; /* invalid devargs value */ /* Return 0 if devargs MAC is matching one of the device MACs. */ - rte_eth_dev_info_get(data->port_id, &dev_info); + if (rte_eth_dev_info_get(data->port_id, &dev_info) < 0) + return -1; + for (index = 0; index < dev_info.max_mac_addrs; index++) if (rte_is_same_ether_addr(&mac, &data->mac_addrs[index])) return 0; -- 2.25.1