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 49F3A43CAE; Thu, 14 Mar 2024 08:41:04 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1BB7342E5D; Thu, 14 Mar 2024 08:40:51 +0100 (CET) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2100.outbound.protection.outlook.com [40.107.236.100]) by mails.dpdk.org (Postfix) with ESMTP id 35E99427E3; Thu, 14 Mar 2024 08:40:48 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=of5NgiWvEIXsM0Oyy17HZQ9Hma63NgQOsbDeVz6u3BTt60CeVV57gQcdHLDPc5rmslRrt0k24rg7eYDf2mxAnwe69JYMzqRxX6pe0lO9oj9VLw7VFlYbYJ3xIwaQi9LEudQlBuTzGhINMYGBy7J9jozlSq8e43M3Z7sF3IjXyPkPpkSNcgOGOl+xtc5WQxBNdd7HyfBvx8HfemlXATlr5fFRYESYQt7GN1ThHTmgO5B9Dhvqfp2ndpQS3kEla8OS+h+R1BpHxqeERSupEOtY++8r5nwWZLOB6ZXa+5+jzp5toxrnExgQcg6R1/XdFA4JZx82AF/q10sUupxVT5pc6g== 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=YxD2yFUbynAFtoKfJmzp5TP0DBJpVwb3og09Oh4Bq/Ce6lHX9oMOHVgBzCFcFKYF5t/FSaeDJPwO8wTF9X62Z2yP5XNPGk766SEJmxFM3A/X9TD5yAwZOSZZr5JpmSCzKU9e6Y6pWKKj56kuQxEwqZKsGoJUl9MtoTY1vT5TIGIGHjAXmE99G+5KqOfIqG4PpoL2THSBtd3HiGPOS1MSfQeylfualdw725T3ZRZTdGjhB3rSUg6GVKFvcDTTk0aLIzAZc3vCVtrkGp0cxc7oDWPB4VzIm2Y1uE15FX+s7v6xSSG+ZMjB6r52Afm62415VeCYqYmeuFwl0YcdRc2TUw== 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=kWtvMkr+P3wPFNycGhaaqkqUXbgGdXPaKmOUwspUWUXcGJRC6E9y7lgTp35ZnOrkl86r8yRSda8FjLDC342FRDv59VPa0wc/L6ndX9Y6qRIxtS1Nr0aLzMYAcyE8CGtUAV0SQ5R7hm087BJs4PLSMHyaSGzuocILoAetNje2fJs= 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 BY5PR13MB3617.namprd13.prod.outlook.com (2603:10b6:a03:21b::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.19; Thu, 14 Mar 2024 07:40:47 +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:40:47 +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 v2 2/8] net/nfp: fix string overflow Date: Thu, 14 Mar 2024 15:40:18 +0800 Message-Id: <20240314074024.3199555-3-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20240314074024.3199555-1-chaoyong.he@corigine.com> References: <20240314070536.3169210-1-chaoyong.he@corigine.com> <20240314074024.3199555-1-chaoyong.he@corigine.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: BYAPR11CA0107.namprd11.prod.outlook.com (2603:10b6:a03:f4::48) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|BY5PR13MB3617:EE_ X-MS-Office365-Filtering-Correlation-Id: 06a3d704-f8fb-43d9-f492-08dc43fa0fe7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: J2fIowVsXldJnVDnDn64T7h1iTmLHGv2rDAbXmdJirxM8l/JKyA9L8qRrjldOcNlBjNkU7IqUMXbjtQiFKjKGWQQ8v2q32Pl/v9R33JV3SmNIzOVk9cYyXfmy3FYs9AhS8s+KfE1/Y+Wz6wqNZNGFPbq6SasSsm0iomK7ypGzJKnLKwxQwcVhNc7I2dpByTjKBsOrtZWa9hngo9szzKaA0vUGd5HzIsrxy3EW2sgagmfKXAgRxaOhWZl0/H8iBrzDbiqA9jFQyNsm7N1Pzq2qhXl5InoPHOmIX2igYuPHMUvmSe3t6PwRhlecvgOkUZjaOIOWaNybpXuF5Ia18GemZFf8Sw/HW0eZ2jPZ6C1UEXLqFjvXNg78CnV8kYf6bj1oPoLV+YRuohwVeAvS7v3WGMXEiNhZ/9wfyLENgpx3li0N0ifZInyd2PggBJ20kjwWanKRiclMhOfc39uU8IGq8GwBJ/Pl3Yf4kgh1dK5upiOo6qznEqugE6cckAof0qu3ZmAE52zwZ8JXGrImFS94ftk4eyvzymxbexlbv5udCDEQpCffin77CKNy+FO39q1jhehy4ZoOgnuhqBtvIRLTXtw6qdYNuHAvRKbB2autERlIGopJ6boeRS2RcB4eWb1dTwu9eG9vaumMPhpFuB8PEs4mf8AhRWZ8bn4HKNnxzlybjzTPrvkbVDoScMnjXePIHEXI+4m3vhBU5RPW2Y0Dw== 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)(1800799015)(52116005)(376005)(38350700005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?XhhtdzKl9NaMg2f8ErT1puKLJkr24YGq3gIhen41GgcKrhlC39R8jkQaSDUn?= =?us-ascii?Q?YyE9iegbdGi0EyBk56wgUHvI7VYKKjCGWo4TbJi07anHbEuCo5rvw/R0xCF9?= =?us-ascii?Q?b31PBt+xtXhBVedrOjjhNEfYwLMsc/yIlWtfGPqZ4InWFqfnQu6KtuLyTWt0?= =?us-ascii?Q?bw/6J+9ENG5fMHAW6zsQYCxxW4/rwLioUL8kIub7b8eIbtvc+zeUZGkHkMCL?= =?us-ascii?Q?FHxXUsHlf/74qrUqPb1h/Pesolj7//5ScqrcN/SLn5p5npVxEhaCv65/Uhwf?= =?us-ascii?Q?6Pkny/tIpKUHFIw0uxOw4yx7leT7K8z265Mi5CVKCglIFvv0gr/BlwYNo9O5?= =?us-ascii?Q?aW7giLRklWy1pl4sj8pfBEaOjeTUkeIrwwkMlGc5Ud08av9Yx052eOch+38m?= =?us-ascii?Q?umCxiooTX6TrjYJR+0H/XAz2yhXrMwBj0FzkXKQhJczHt9TQqgDBtAQC3Tmx?= =?us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HMVINktiLtYGsGn6hoFvJbHapTMAsV1?= =?us-ascii?Q?4VLXNHJMYj2HNXwcZP4nQgdT5pY8zEVDg5UD/cnFJFnn6U0scL1rVrIuJVks?= =?us-ascii?Q?6VbDVa8BMpJ5vPooSMu/bLmTaYSdy/AjR7GBtQrQNsAG+iaDKEDzD4YHMlmk?= =?us-ascii?Q?982UCsUHNQMlg9WF5chC/qtXvtK+x4CszkH/NkQuBhdFdsMypGTJqIOPErgz?= =?us-ascii?Q?y1+5KZUik7e0FfA4dKDZ16FXol37q8evivMRXiaLV9Wr7EpfIGcUXepbZimY?= =?us-ascii?Q?bQ=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 06a3d704-f8fb-43d9-f492-08dc43fa0fe7 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:40:47.0409 (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: B32GmkLoVulohSBCwbWus8RA9bX6mONfcEoI4j09CuVLOybbZGUcPnCTWZeize4t6d0W17UaigmvUJ0HM7PbQiSH/EH+ImWos78v7xl3G3k= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR13MB3617 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