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 72B3E45AAF; Fri, 4 Oct 2024 18:26:01 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E9BBF42EC4; Fri, 4 Oct 2024 18:24:46 +0200 (CEST) Received: from mail-pg1-f176.google.com (mail-pg1-f176.google.com [209.85.215.176]) by mails.dpdk.org (Postfix) with ESMTP id 1989642E69 for ; Fri, 4 Oct 2024 18:24:37 +0200 (CEST) Received: by mail-pg1-f176.google.com with SMTP id 41be03b00d2f7-7e9ad969a4fso1420084a12.3 for ; Fri, 04 Oct 2024 09:24:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1728059076; x=1728663876; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=us2lB3yfgcEtdfiFy5cYVg5HPWXenGG4ifroscQAYoQ=; b=TbN3DXPJmI4GvHfLfTTQCFlQCtWfAAlq/HiXdNzzeEKhUmPX7hZpe6Yn2UN3NUKiUS AV5ml7wCHB+QTEn0+bHCQEHFp501ejqbPWitZPj1ovCEXhFtYege/v+4K9Lb3IyPlZvI N2Z0OCHGkAECRPyjnqXIGenaialur6ROZGoJz6rkvCGGD+AdCApaN1lRTMBi2riyxGGt I1SzrvVmH7vMw57x6VOvbuW1Jl3nCxBFyxj21pkUuWZvg6y3T9VdmoxsQXVI6PU4TjEx tUk/wFypWugF407R2S3BcZM+qaoSbxuFOeNBYQ0oGJM6vP558bSEI5cmrUufjR9n7vKL g9cQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728059076; x=1728663876; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=us2lB3yfgcEtdfiFy5cYVg5HPWXenGG4ifroscQAYoQ=; b=dTbLMAiiTxh8OmwaZ3ACJk4XqJwOV8hFrKsvxr87DoUJdDTA9T1SWZDYQuqknXEXFZ +0uD0eorh+GO+dVx63dA84WJkBKc5o7u+zh9BTFwpMZg/m0/Dfu77o2tj+yqBcoHkgr1 sNZ8ytcxch5JWuuuQP0iEG/ZDsc7fUlI0hkG6FOdbYAPhYAQ0E3b2KmRhNMIikAh5aqL /dbs8KBthAS1wOpVCFyF5faGz2TWLk9z61jKFqGis/zMpH+53nX1GezgbJkReFYG+oeH biGdb03KE3utl7+oLKwFVEbMYIRzqr9u1rkgWCOtCmn0cN9aQXu6aB7Ltf1BXPDpQ37g VAnw== X-Gm-Message-State: AOJu0Yz296GsoLn4EpbXAzvVFsH0hhJDINRDXFi1VPw1uGh0RxGNJxif YsXkuLtONaiN41oBYM63GJv2f1NFxDiGqneAquJlYYtM60/VwI2O6/49IYOayp/53RB6uH/Jw+0 SOXi1qw== X-Google-Smtp-Source: AGHT+IGOgdZ0sRrmhmFvCCUaYBgZxL7Emjibi2BKbrtx4sSROWhrjwtlKmOin2eXMAo+olscL48oPQ== X-Received: by 2002:a05:6a21:8cc4:b0:1cf:49a6:9933 with SMTP id adf61e73a8af0-1d6dfa33d44mr4132666637.20.1728059076228; Fri, 04 Oct 2024 09:24:36 -0700 (PDT) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7e9f680d7a1sm139231a12.19.2024.10.04.09.24.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Oct 2024 09:24:35 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Thomas Monjalon , Ferruh Yigit , Andrew Rybchenko Subject: [PATCH 09/10] ethdev: check return value from rte_eth_dev_info_get Date: Fri, 4 Oct 2024 09:21:56 -0700 Message-ID: <20241004162418.52940-10-stephen@networkplumber.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241004162418.52940-1-stephen@networkplumber.org> References: <20241004162418.52940-1-stephen@networkplumber.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 The mac compare must check return value from rte_eth_dev_info_get before using the dev_info information. Signed-off-by: Stephen Hemminger --- 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 b52f1dd9f2..43e13e02f8 100644 --- a/lib/ethdev/rte_class_eth.c +++ b/lib/ethdev/rte_class_eth.c @@ -50,8 +50,10 @@ eth_mac_cmp(const char *key __rte_unused, if (rte_ether_unformat_addr(value, &mac) < 0) return -1; /* invalid devargs value */ + if (rte_eth_dev_info_get(data->port_id, &dev_info) != 0) + return -1; /* device mac address unavailable */ + /* Return 0 if devargs MAC is matching one of the device MACs. */ - rte_eth_dev_info_get(data->port_id, &dev_info); for (index = 0; index < dev_info.max_mac_addrs; index++) if (rte_is_same_ether_addr(&mac, &data->mac_addrs[index])) return 0; -- 2.45.2