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 378B8A04AF; Mon, 4 May 2020 09:12:29 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id ED3441D426; Mon, 4 May 2020 09:12:25 +0200 (CEST) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id B90E81D422 for ; Mon, 4 May 2020 09:12:23 +0200 (CEST) Received: from Internal Mail-Server by MTLPINE1 (envelope-from matan@mellanox.com) with ESMTPS (AES256-SHA encrypted); 4 May 2020 10:12:18 +0300 Received: from pegasus25.mtr.labs.mlnx. (pegasus25.mtr.labs.mlnx [10.210.16.10]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 0447CH8w002585; Mon, 4 May 2020 10:12:18 +0300 From: Matan Azrad To: dev@dpdk.org Cc: Viacheslav Ovsiienko , Maxime Coquelin , stable@dpdk.org Date: Mon, 4 May 2020 07:12:09 +0000 Message-Id: <1588576329-15792-1-git-send-email-matan@mellanox.com> X-Mailer: git-send-email 1.8.3.1 Subject: [dpdk-dev] [PATCH] vdpa/mlx5: fix PCI address comparison X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" A regular memcmp function was used to compare between two objects of type `struct rte_pci_addr`. Due to the alignment rules of compiler structure builders, some memory is not initiated in the structure even though all the fields were initiated. Therefore, the comparison may fail even though the PCI addresses are identical and to cause false failure in probe. Use the dedicated API to compare 2 PCI addresses. Fixes: 75dd0ae91765 ("vdpa/mlx5: disable RoCE") Cc: stable@dpdk.org Signed-off-by: Matan Azrad Tested-by: Noa Ezra --- drivers/vdpa/mlx5/mlx5_vdpa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/vdpa/mlx5/mlx5_vdpa.c b/drivers/vdpa/mlx5/mlx5_vdpa.c index 9f7353d..1113d6c 100644 --- a/drivers/vdpa/mlx5/mlx5_vdpa.c +++ b/drivers/vdpa/mlx5/mlx5_vdpa.c @@ -305,7 +305,7 @@ DRV_LOG(DEBUG, "Checking device \"%s\"..", ibv_list[n]->name); if (mlx5_dev_to_pci_addr(ibv_list[n]->ibdev_path, &pci_addr)) continue; - if (memcmp(addr, &pci_addr, sizeof(pci_addr))) + if (rte_pci_addr_cmp(addr, &pci_addr)) continue; ibv_match = ibv_list[n]; break; -- 1.8.3.1