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 CEC9EA056B; Mon, 21 Nov 2022 21:40:36 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4441842D34; Mon, 21 Nov 2022 21:40:34 +0100 (CET) Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by mails.dpdk.org (Postfix) with ESMTP id 14EE442D2F for ; Mon, 21 Nov 2022 21:40:33 +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 A8CCFB815DE for ; Mon, 21 Nov 2022 20:40:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B40EFC433D7; Mon, 21 Nov 2022 20:40:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669063231; bh=RgYWMx2bXw0Kf6OSgrUuQ2FaHKOsqLyY7fKYUDdVLR4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q4JHcw4egEEf/kwJQerUjEG0FZupMjsSfXoMXhFkRydBdIVYrzfkxLrn0v2oNBFQ0 tSYSu/e+4qzAcGm1ZUQgHYqYDVj/1fNfsv2bc+YdIS+Qyr3zIBW+GlNlzcA9ug4D8a rRxRom/Wa4AdvwhhyNj5oqipXBCOwX6P+rd/Z09y8wVtlpm79FFB+IFvwDtjF6PEAc Jy1f8qhEHTt5S0F1+0VAowvfS4MQlECMcFKHiFN412NGcu+p8s1VCDRKk/R70TSotT GwFxnyfqIr/11hQCj+lrBo104mBVHYJav8Yf7Ohq5m14uf8j0hFMd59kG6iRSbZyr5 AtZ69DPxEtQaQ== From: okaya@kernel.org To: dev@dpdk.org Cc: Sinan Kaya Subject: [PATCH 01/11] ethdev: check return result of rte_eth_dev_info_get Date: Mon, 21 Nov 2022 15:40:07 -0500 Message-Id: <20221121204015.1135573-2-okaya@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221121204015.1135573-1-okaya@kernel.org> References: <20221121204015.1135573-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