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 BF900A0032; Wed, 11 May 2022 15:59:15 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B2246410F2; Wed, 11 May 2022 15:59:15 +0200 (CEST) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2062.outbound.protection.outlook.com [40.107.236.62]) by mails.dpdk.org (Postfix) with ESMTP id E7C49406B4; Wed, 11 May 2022 15:59:13 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=k2u5apNnapjCecYN6JPQ97aOY4nu7Dj2suyKhn6K2GYg4GecYF2S0doSn+VSxWYwHnULFAy0qtvHf7t8YR7zc9r6nv8fI+2OVo+s4ShILuNwfePqkDSmhLU7NFs5FbPWbWpnihWbDXTG9XHBx24sR42UBmOx58G9r4fnURJiq1qKCDLKVPTqKvknZK8u+WC8jNBT9+Gf/JY4kTtOZoAvGS4MBC+GKM/imN2LqVRZEjkaO5nW00jW7p0cDGn/d/i5lqO5cWgm6DjeyEz45QZlUN5pHfo+d7iSatROlOu+vN8jDk4hDiYMosSJeaBL6KI/vdyBANSQO/hBR6W96D3eSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=hId8VObyWTgc5lhj9E+KoSO4GVU4sRVGdy8xv6cmLFE=; b=M9kB/wzmDF/VoV3rsY6htpajGq3z5H/K3YD5HZDECBsP43z22DzrKRWAeu8TERdP0PdlhEjU73ZZBl2QrqFDHur6ndhkEyIoomq1BJs+tUA5/vJm10se3ZGB2YF8AowIkAjvzxUlvIjN+aVg+cpHnkzuTfFa9u/UuKBTNwprrMs9Yu/U2hp/mzLT+wO68zEP8uumvGGM1sZgDBjRwAY2AJ6HXkRNUg82ehFjhcOEXbMAUveVnDARjADC3LdNdL3eNYwqrHkN5bIvo2j4FzufyqOimihE83GRKWf2ytbJFCMS9dfFLDIfvsfSpogjBl8aSIbkGBY77RLQUrW4Ncq7Uw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.238) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hId8VObyWTgc5lhj9E+KoSO4GVU4sRVGdy8xv6cmLFE=; b=JCLtCYJH0WbRf7eHuM3hTLj3pUz2w3tS3WwuPeikZkol2hby7P5TBa/u/gWc4u13YnmNZfa6tNKApws+9RU4stuFBTkzH7W6YK6n8WPw4ku6RX1OYCvIsqal9KB1J4tjTIpUFNCISEJHAqujVl1EGitL7OAe/LqYKkicGpUe4uY+5bA6gxlNIZdytFiSdNVbRu0JtpE2R2UBjxGwXP+Y1s6MBCeoWVLyPZvFYXW9nAdKKJKtVIoVmOJKyHHUxg7wFbKhXp1yeMZOfDCHILfHE4uIR3By/UMSchvtX443Zw6DDW+hOV7Lv3F98M4PEEtWK4RRUwSHSxkdpUWOvAsRBg== Received: from BN7PR02CA0014.namprd02.prod.outlook.com (2603:10b6:408:20::27) by MN2PR12MB2894.namprd12.prod.outlook.com (2603:10b6:208:10a::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.22; Wed, 11 May 2022 13:59:12 +0000 Received: from BN8NAM11FT024.eop-nam11.prod.protection.outlook.com (2603:10b6:408:20:cafe::e1) by BN7PR02CA0014.outlook.office365.com (2603:10b6:408:20::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.21 via Frontend Transport; Wed, 11 May 2022 13:59:12 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.238) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 12.22.5.238 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.238; helo=mail.nvidia.com; Received: from mail.nvidia.com (12.22.5.238) by BN8NAM11FT024.mail.protection.outlook.com (10.13.177.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5250.13 via Frontend Transport; Wed, 11 May 2022 13:59:11 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL105.nvidia.com (10.27.9.14) with Microsoft SMTP Server (TLS) id 15.0.1497.32; Wed, 11 May 2022 13:59:11 +0000 Received: from nvidia.com (10.126.231.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Wed, 11 May 2022 06:59:09 -0700 From: Ali Alnubani To: CC: , Subject: [PATCH] net/mlx5: fix build with clang 14 Date: Wed, 11 May 2022 16:58:15 +0300 Message-ID: <20220511135815.1564053-1-alialnu@nvidia.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.231.35] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c15c92ba-3ead-4474-edeb-08da33566d43 X-MS-TrafficTypeDiagnostic: MN2PR12MB2894:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /pkJNiZWKcDy3e/n1hj0Dpj6S7YPkpe/um+ANS5mRiailx59O9qVA6B00yLN6RSn/VWDMzRFGaw8nkuyQCIlXhdVoPbKQk/Q+EucaRGbeNUc32ei0P6pLg8V8EQBGUmpJxd+peipelg5hJ8G8CbqKYvwCoHSYWVe6SJviEsI2AP0AVkoBqiuwjKuFOIxL0q2V2GHhU9CunNjQ+H22d5I3rpq+lgdiR8tPbx9FPHyfhdVp9p5prt2uXuzqrW0GkGIDEQ14o1bOjLDkOZ+0J8ZIQYZes3SpsFlrpruh+xZKib6XIhqYepwkZDL6IUEKDiiKC4fPItzjDr7Mrjy3CvxmijUqPUA02v15KdTDYcdUKelq6A9G/OxqfWQjgFjmMjK4HXpxgpltAvgk5xaNxdM4amec+UHcuxZh5cN34A8Wum2ZdGFzA8yzC4NXpDuTmBbhqdm/zHoI0R5KNFkQqZLt1dbovoZh1xg5zLA2LehDjcN5z24qsso5AZK40jDEqTK9wD8RZM9mSvYBfM8tPvbsFxa6mgjdLCiY7GOEAj202wWoHeZLIiD4ECUO8N5uYsCOpMkNO4rXbKw+LFsPrXkSb5PFUe792DU3xm0BPvFmBCa1f5RL3T1FirWTYBlajKZE6fMWgbYfb1n0TckpMfHFIwfXyfI/wTBke3z80EhF9QmMaBgfAfZJ5fzfeNFZAXZbhb9C1T01nxoYr46gYPHgQ== X-Forefront-Antispam-Report: CIP:12.22.5.238; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(13230001)(4636009)(46966006)(36840700001)(40470700004)(2616005)(5660300002)(70586007)(40460700003)(450100002)(8676002)(6666004)(70206006)(356005)(6916009)(4326008)(36860700001)(83380400001)(2906002)(55016003)(86362001)(81166007)(36756003)(6286002)(26005)(1076003)(47076005)(336012)(426003)(508600001)(54906003)(316002)(186003)(16526019)(82310400005)(7696005)(8936002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2022 13:59:11.7844 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c15c92ba-3ead-4474-edeb-08da33566d43 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[12.22.5.238]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT024.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB2894 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 Use fgets instead of fscanf to resolve the following warning reported by clang 14.0.0 in Fedora 37 (Rawhide): drivers/net/mlx5/linux/mlx5_ethdev_os.c:1137:52: error: 'fscanf' may overflow; destination buffer in argument 3 has size 16, but the corresponding specifier may require size 17 [-Werror,-Wfortify-source] ret = fscanf(file, "%" RTE_STR(IF_NAMESIZE) "s", port_name); Fixes: 63d1db710fbc ("net/mlx5: fix unlimited parsing of switch info") Cc: michaelba@mellanox.com Cc: stable@dpdk.org Signed-off-by: Ali Alnubani --- drivers/net/mlx5/linux/mlx5_ethdev_os.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/mlx5/linux/mlx5_ethdev_os.c b/drivers/net/mlx5/linux/mlx5_ethdev_os.c index 8fe73f1adb..3d28597e7b 100644 --- a/drivers/net/mlx5/linux/mlx5_ethdev_os.c +++ b/drivers/net/mlx5/linux/mlx5_ethdev_os.c @@ -1118,7 +1118,7 @@ mlx5_sysfs_switch_info(unsigned int ifindex, struct mlx5_switch_info *info) bool port_switch_id_set = false; bool device_dir = false; char c; - int ret; + char *ret; if (!if_indextoname(ifindex, ifname)) { rte_errno = errno; @@ -1134,9 +1134,9 @@ mlx5_sysfs_switch_info(unsigned int ifindex, struct mlx5_switch_info *info) file = fopen(phys_port_name, "rb"); if (file != NULL) { - ret = fscanf(file, "%" RTE_STR(IF_NAMESIZE) "s", port_name); + ret = fgets(port_name, IF_NAMESIZE, file); fclose(file); - if (ret == 1) + if (ret != NULL) mlx5_translate_port_name(port_name, &data); } file = fopen(phys_switch_id, "rb"); -- 2.25.1