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 4F68243CAB; Thu, 14 Mar 2024 08:06:14 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5CDB242E4C; Thu, 14 Mar 2024 08:06:06 +0100 (CET) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2093.outbound.protection.outlook.com [40.107.220.93]) by mails.dpdk.org (Postfix) with ESMTP id 1AAAA42E0E; Thu, 14 Mar 2024 08:06:02 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=K4bRI+MWVhR+URdPCKmFLmiOr4VmqkH8L0GqcbCZY9hKz89YFWYXEQfgPQguIKTu3RFw+AaWcQcNtZ7V9c5YMEpRycjkpUsDkKJIUKXOwPIrhVj9V0IJRalAbhw/k4b4+qnGzhdz8fb3RK0LC6UXm/McrGyES4FVMjYpDoncP2O+FH/TPoCfyEthdqtv9gSwcUaPrRoKiYBfPRMhHJ4MqYD6xO6buCuyYVmQhOK7MUnsOjWkNkeJe4x1z+O6lJfPxBKllECLc+//MAnSgv0VKKNeMORZtmIyinvrlnRGjAHQNUDhBWuVi1ApP68ql5ySrmu542B/ozZfQG787Ns2Ow== 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=JaFGoOiIoNM8JGn8TyVkhQw/RM+1oIucUqEJ23jhcSA=; b=ROXc5A8D8RJPvGLIphXBV2I0yIutM+T1QQieHc5YvdgufzPq+XTe/O2QePID7r4viErYrkIlQqnXFJsVxpO3HmYwrtSChWH5SnlwRK/2L1ITV5C6/xGJ3sA3B6B7k78du85r8B+1IV+haSWn+YyggxG+w33Br7j2hL6NQdwvwe6pE35+oe1kcKytDlGt9/YGcFdzafjip5bY3CNMLbrq3mV0OQO4+xu12js8a3WCG/QFfAFGm4pDOWcAPpQmZXBThmLgK9bLq/iK5LZls/R2QSpodlvhAg8dVOzubjyatmxendUTyDpzKoABffsjRruk9XW6My2hJWfum6xwUrecZQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=corigine.com; dmarc=pass action=none header.from=corigine.com; dkim=pass header.d=corigine.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=corigine.onmicrosoft.com; s=selector2-corigine-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=JaFGoOiIoNM8JGn8TyVkhQw/RM+1oIucUqEJ23jhcSA=; b=c27EmblkK3Vt91dXQkfT7CcCMbPfQIKlTCf9AJJqP1yuqNOM+YjsQawmTECf+3UudT+QDLitxEpYuWjmB9Yk9djD6hZZn7xDF+yrFlwt60O2trRutjro7vbthdU59zLYYSN6JdRk0WXddph45AmntxqcVjSN1POZ7Qd/pwkd4S0= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=corigine.com; Received: from SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) by DS0PR13MB6235.namprd13.prod.outlook.com (2603:10b6:8:115::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.21; Thu, 14 Mar 2024 07:06:01 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::ec12:7411:559a:850e]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::ec12:7411:559a:850e%5]) with mapi id 15.20.7362.035; Thu, 14 Mar 2024 07:06:01 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Chaoyong He , long.wu@corigine.com, stable@dpdk.org, Peng Zhang Subject: [PATCH 2/8] net/nfp: fix string overflow Date: Thu, 14 Mar 2024 15:05:30 +0800 Message-Id: <20240314070536.3169210-3-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20240314070536.3169210-1-chaoyong.he@corigine.com> References: <20240314070536.3169210-1-chaoyong.he@corigine.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SG2PR06CA0191.apcprd06.prod.outlook.com (2603:1096:4:1::23) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|DS0PR13MB6235:EE_ X-MS-Office365-Filtering-Correlation-Id: b9eca307-873a-49a3-00ff-08dc43f53445 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: M8lpKUUDEZxtTdui8BnZJF84x72Bxt8gQ+pZFh6QEbCBD6meChB8c3uY4cQZynT6Dg397ZHyF3usvYe1c5T9QiW/7JP6fdHeHn+RIP3IxpZKa4fvJGsbb/f9vwJR78prJI0SqJ7h1u+bCgVflBCBslBWybQ599UhrASIiL4ZIcqwhUbWRtYf5V9sTyVtZbCPEU53NP5izuMRGYxt3tVi4OunPvnyHKMW9zOzb63PvBVF29NErKI+SVgU8QpDG66vlHEjr06UDa73RyjCAeE3yQ5D8ICayjX5ACW9EckVwy/7EQu+EplQe+jgLrIneIFYKjTDN8DgmEw6gm9lPnebUPj1ERgJF0gRPCE/d2NrS7xfQNoHFmBuzHWr56DqXCKat6P/3yFu5isA6jFs6aE2dBzg6CVTkBTk8lrHbCsfb90eYYarBVPn16yDgftI5H0lhTU4WebEw6oB2ldDVR+7w+xhY3rb4uAl5g2TlmAgfNv+zbWWfjgi/F8wQ0QEEAMBfIKoN8CFai50mwZ/AMPVmrQRw7qSoN9kB4X6dadDup/TNQY9luSaFXXJ0IbLnHLISC5nV1B5N0x+nwiEU/XzpHAGXq4/dZa2Nn5bVKWvGdBe1UaojGJnkweZxCz1q4I/nx5WYOJM1I7TJVQGWJLwcZRYtpZm70LGLRpicBBNqilLC5+KZSMtprQHMCKR5QzADYE+l1quWnXV3KRIXsUR5g== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR13MB5545.namprd13.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376005)(52116005)(1800799015)(38350700005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?BC3OIR09O27L3ek4Dw6HtuazxF2PRR+mP9r5TfUxblcyDu678qf5VXHwDkIg?= =?us-ascii?Q?/0O04iGhj5gGmJ3DqdOQlGA87u1jbmLrNsyHf7B6dfcWVj8fbnE983VQDJlp?= =?us-ascii?Q?/jZkeM3InCJ4CEJk5stOOqeOXaGiwP8+bF7rMPvvVN7XBXpiMWeSEw/kV6D5?= =?us-ascii?Q?tgTSw03rO+bn4BjwnArPPHU2IqIqaY6fj5lhuQTu9Qcg2iqeAKphQA5dwVB1?= =?us-ascii?Q?Elnsfm2HLON/8viwcW1cNOhjBYKss7+g/A+RWqh+nKL/8SA8WnQxn7oScvOT?= =?us-ascii?Q?cEVWWh8DyS+922R6TD7EZhd/TlrWEDpc7OvqfKwoJtgGfMOrYUUA7Wt9rWJG?= =?us-ascii?Q?BO/EgO/XsJIBm+rR/VMiFhr+y5HnWNRAlZvSA7kFle6GPVUVo06My6n5H3B4?= =?us-ascii?Q?A/DlJmwIgX6m3ot9WR6jzAuF7QYXcabk0p3sL+iklG9YFcTzmZ2Edj9CXnlM?= =?us-ascii?Q?jy4w2Tn+TFrnyGQ6uRvPq9yNVRszwDLhQX1MJjJy9JyUOJ9gwe/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YlvTYidSgMTZThN3Xkdu8CIDV8j?= =?us-ascii?Q?5ODs/tVnyNuUWVMpJn0NZSaUri5YY2stORKLwAOfEE7ommrdtP3x+j3lDZWU?= =?us-ascii?Q?JrXVuI6GmvX010AyDBDskVnRcjwo7k9XHSidRK5JNWsRLRRAKw+bFbR2aGAT?= =?us-ascii?Q?GFYkvZrWOvaVTS9SxNW6bKCLnNHV3dmadjJH0IXDlHmneNjOEXMsUHr7kjnz?= =?us-ascii?Q?Cg=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: b9eca307-873a-49a3-00ff-08dc43f53445 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Mar 2024 07:06:00.6865 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: fe128f2c-073b-4c20-818e-7246a585940c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: BBJUQ16StR4DiFE+eQDB6ziaBNBZAKzSeLcqRLdoQNaXBbBbaBH34S3LRrJ2qrS4VcHBhKMz0WgMF2fL+9tKKa7MTrVJV/R0O4Ph3M5h19A= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR13MB6235 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 CI found in the logic of 'nfp_sync_pci_inner_handle_alloc()', use 'strcpy()' may cause string overflow, fix it by use 'rte_strlcpy()'. Coverity issue: 414937 Fixes: 6b4273a03779 ("net/nfp: add synchronization module") Cc: long.wu@corigine.com Cc: stable@dpdk.org Signed-off-by: Chaoyong He Reviewed-by: Long Wu Reviewed-by: Peng Zhang --- drivers/net/nfp/nfpcore/nfp_sync.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/nfp/nfpcore/nfp_sync.c b/drivers/net/nfp/nfpcore/nfp_sync.c index 8bc38d6585..686cdf8eb1 100644 --- a/drivers/net/nfp/nfpcore/nfp_sync.c +++ b/drivers/net/nfp/nfpcore/nfp_sync.c @@ -9,6 +9,7 @@ #include #include #include +#include #include "nfp_logs.h" @@ -266,7 +267,7 @@ nfp_sync_pci_inner_handle_alloc(struct nfp_sync *sync, for (i = 0; i < NFP_SYNC_PCI_MAX; i++) { if (strlen(sync->pci[i].pci_name) == 0) { pci_avail_id = i; - strcpy(sync->pci[pci_avail_id].pci_name, pci_name); + rte_strlcpy(sync->pci[pci_avail_id].pci_name, pci_name, PCI_PRI_STR_SIZE); goto common_alloc; } } -- 2.39.1