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 0176E43CAE; Thu, 14 Mar 2024 08:41:52 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9EBB142E96; Thu, 14 Mar 2024 08:41:02 +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 6AD6A42E85; Thu, 14 Mar 2024 08:41:00 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EutW/ewomm3I9e+OoJokiUtJLpZL0a6xCuehxj3/MCgB/FRFg2Pc6JnXWkSqLEDMO7eFd1AmKswjJ3qfbhK2jEY5npZQuRFR98gACymz6hag4Ul8ITJL1kxqbN6yflRaXQzzEiqyFtIzXrdfTDma7jE2mgiPBIulPVW6jR2oNZLyRVdb+Ehfl9vBxDhbSUX29AvJQwrlUMI3zoDbqKKjRfueUSGt2xlluNYQ3li4dfBqYI9p/x8K526OjVthIfXc3FvSxGCPiNc2WDGUaau4rh4WLF2r655jD21WshaQs+eM3myf6M4UUqLqsECy9F2hwGGhI07txRNlrbJrg/Mo/g== 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=2mMH5drtNtdQqTuztBvlVEuaMT6t6fMbyiwgFPLQ/X0=; b=jqY9g5MJbRLbtgoqx/UpmOui+33Rx/p+WlXN/VjUanaxCV7SlHFp8G4+r+DY5I1xJeK9Q0op339ETXVUIPf+QMh5iiiu+QqQAbolZx39VHGd761ox3cBWCO1hLK4udP1aywjdU81lrPYOKdW3CZbyeb+NxIwpmhwCUj3d6++EFu4pGqPZIUmOW83FhvC0yoo+koZzlmcoAnP/XX1de8SQUsccrAQS1kzq80u7w0R24rDY287JGV0f6RFncVLKi3X0Zw1RHlCE5jGz4rkOQ0ftM97QbdZgrngW9CPyN1OjcdweDoLK30Vl7/9xAio2pPv1KHB4t9YoqHydW0EafBb8Q== 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=2mMH5drtNtdQqTuztBvlVEuaMT6t6fMbyiwgFPLQ/X0=; b=BZJAGuB56CGDSZAdN/qZK3UJLubu9F8l0fVMxNAxuzMQoDaFf/pD9MflGNczp4BNAOp2sHyOUOWLRGICV3ocHPqTtcP4WhtzDDpCLc1K7wAf9i8dgBslLdcmRFBesX1Pulnz/r3zBpXvEa4CQk8WGQA+4X5idP9EWl8WCKF3LnM= 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:59 +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:59 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Peng Zhang , stable@dpdk.org, Chaoyong He Subject: [PATCH v2 8/8] net/nfp: fix tainted scalar Date: Thu, 14 Mar 2024 15:40:24 +0800 Message-Id: <20240314074024.3199555-9-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: 01ec26d3-2260-48db-e49f-08dc43fa171a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NscTN95vjfbq2+fsQuvlg9oy/a1wDotgT0EGq2F8woCmtRDjVANQAT3b0UvSuCD41ONqG258OTrlmDM+py2IFUj2CdqDqv0l7PscEjOCOZnWJR+c/966FTLeAoQh0vfrty2/SPAh1/4R12bVN0q/LD7egM71IVdn+gi9GINGpd824WPlU6DxZTYA9znraaJAjvl1Ju/53rBr1LoV7j4rOPKHGN7oegElTcwcCiA2YTKqsYqxIaAIcU8peB3Oxo6O7D83pwAAf8RvDaoEYUpqelRwZM/lJcFrzfuBX++0TDozGPxRhc/F4oGex/EUzxdNlMOAQM9XoL/IS3t+hgYAVf06v0Tl4mn44bOT+RlPgqwZStUkYzh+jl18dXlkkfWHYK1hH3AT5F41CyIZK+o5BFV/B8L3lqI4VFcWRbPuxtBTnOyAqBSs5Ls3B8Z+8Vgjl1Fs87qUMyUhz2CgZG2X55GpReZMzQS9DUlIbyQYw0SqI2BpHQhJTnyKdEMz4PRAWhiI72GqYRbxjY4nJvw5oQwzDA9SIAih29AqPqS+lW+aCPZSkhqD8cToSe1QT/gxyHxru4aM4qHPgS/JVrVmk263lZkvVE87aOYkCmAy5xt0ANUw0WWqjT+WFU2a68Eyz8DLR+XlErbobRSwPdEt4pdO6ylUFoMQdUih8A5stAoP+5vPCkLYg9FqDGz7vJIsjnH3ptsuVAHHMO+oly9pF3NWhpJKREyohZTSTfZFnPA= 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?GPQ7MdsrwHffbQECsnb8QJrEaMFFS8fOWeeL5Tj3tEgDcjArYxYyTVzGYttv?= =?us-ascii?Q?ZF2+r9XByJ+p9AkEQ6Ziox1vP2WxrESNruCnm5B7kDvX4VUYXBrFvn0zpAuS?= =?us-ascii?Q?u4X0NJKjp0yV4Tr5uUCQrnKK3P9U1Lvzvh/a33E8+6Qmb9fMKv76dpOTy4L7?= =?us-ascii?Q?2/9sXwzueCJgHu7Vrx5H8M9k2NrrduAvndqX1HXIUVEgj9x5AUMRdbnOZdmH?= =?us-ascii?Q?wlXCSowvBFdkUHgOXaC5dkTmiZM21XqL3Bk6ttj9vgm+E8qQMZxbjrgpF4ly?= =?us-ascii?Q?de5SnClWOTNyKLIFSRUMqxQdYoFw6ZmJnVzEzysK8l1GQOlgMEVI8RTcqn51?= =?us-ascii?Q?IK9It4VK4Fi/meEAebsgiY4nSZexXcZsSf6Jct4y6KiUD4QypbWrYEAOC3lC?= =?us-ascii?Q?xlFappqnFixdItvyKsct7XPKOop6/EmoXixlDznq/fA5dtabC/TweabPh+ov?= =?us-ascii?Q?lH/EZHviB7lAhlgrnXD5h0UgCNEWugaskP+OTb5t3vNEHNJRl6m+gWy846Vb?= =?us-ascii?Q?9DLGbAcOG+3dBIaqzDQEAtxLeUcPBxhOsveiwhK3SAc2I1aYcVRV/+dxLUlR?= =?us-ascii?Q?0LlkTZbKlm7wwJYsretc3pROtJHn7zxauCKVcyAH19iekGzmdscVR7SVQ1Ch?= =?us-ascii?Q?n2a59pDBMiKfTytaM4MbQkxQ5yuISWJnycz4OsqHpvYh1k9Haf9HY5w17PYx?= =?us-ascii?Q?phdCjoRsw6tqVt1JJ69teItA8eecPZfgdwnddeZLPgLMeoPcY3JX6cgB4d35?= =?us-ascii?Q?pFDndYEVYbD11LYTYR9wrr5apsGZaMqMyHRS/nWOhoeG3xqz7wZPyJOuZAPX?= =?us-ascii?Q?wZBouBIZmd1x4skD434JuGoxtzEL6DUFOLMthhiBir0NkckEmTY14pCDCMd9?= =?us-ascii?Q?k1JJ1IuNCSf5cPUWHIzqoLMOVHrujKNQdv3F/lSlK/q1t4NDtRQvRsktzA6c?= =?us-ascii?Q?n8zSZuPhquMAjIhJ66MSjsFJKF2fS996q5eLD42851HP79+V68mgPJZjrQqy?= =?us-ascii?Q?Ec3i5X0drjZd2klD69qwP9LNp15rlfF+LoAiQ3ycETxCak0PTGSvmJjFB85E?= =?us-ascii?Q?Qjm79vN6pQLfWVGjyaTtxAirll5FhlAtflBozixcNghlg0pzOwi/XzEuXBEv?= =?us-ascii?Q?+z8pCMR6X0QSMQYHohbmhqIZ4xhZEADkCQu3L+nyJg1iP0gynKxucvclXD+c?= =?us-ascii?Q?KLp1x8Dxo87oo8th0g6vJOiQ8ochLesc9ilgcMqODgWnIARcQSOueMJ46nfN?= =?us-ascii?Q?JPQb71ZIU6Ahuao2y/1PfTgVY5/NNT6cSFENN1yO4PfWN7+nYOPN7J4j9A0p?= =?us-ascii?Q?DM46cbFxCIqGZobHbQdUJz/ueXb/FhBWw+LEpfZ5FMATygoldUghtcImmWpZ?= =?us-ascii?Q?L0wJrr9ed6vRKEGMOl3rA2h5tBmqosJ6m33HIEqeajdiaX2vyjsUl1mKpJuI?= =?us-ascii?Q?Vc/17QLsWy5NlKhaKqT27QACZra1GygwE56aKhAQ5sXcgj76LFHFbip1z6ax?= =?us-ascii?Q?Wu1AIJJAcMKMP+X8yNkSNnQh9VYZImUqDO8By4O7RqaUrXq90zJIFfv9NrQ/?= =?us-ascii?Q?4rdtXNZFc8m4rMSMDYQy//DKgEQrT3NmpxJDO2nqt5wUDqTIY1+ZA88x+rve?= =?us-ascii?Q?Zg=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 01ec26d3-2260-48db-e49f-08dc43fa171a 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:59.1103 (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: 1DdjOg6EuPxhNFEbCReL84gOIZgMMTgBR3LNidgERZyfwZbhLHdRzP07R8ZmDNrezsDxhMtvxm8gaR6Kl6My7lXQV83EoDqFgF/+SYrln7o= 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 From: Peng Zhang Passing tainted expression 'ectx->fw_info_strtab_sz' to 'nfp_elf_fwinfo_lookup()', which uses it as a loop boundary. Replace tainted expression with a temp variable to avoid the tainted scalar coverity warning. Coverity issue: 415051 Fixes: c82ca09c441c ("net/nfp: add ELF module") Cc: stable@dpdk.org Signed-off-by: Peng Zhang Reviewed-by: Chaoyong He --- drivers/net/nfp/nfpcore/nfp_elf.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/net/nfp/nfpcore/nfp_elf.c b/drivers/net/nfp/nfpcore/nfp_elf.c index 1bf68ab3e4..cfa59ed16d 100644 --- a/drivers/net/nfp/nfpcore/nfp_elf.c +++ b/drivers/net/nfp/nfpcore/nfp_elf.c @@ -324,14 +324,13 @@ nfp_elf_fwinfo_next(struct nfp_elf *ectx, } static const char * -nfp_elf_fwinfo_lookup(struct nfp_elf *ectx, +nfp_elf_fwinfo_lookup(const char *strtab, + ssize_t tab_sz, const char *key) { size_t s_len; const char *s; size_t key_len = strlen(key); - const char *strtab = ectx->fw_info_strtab; - ssize_t tab_sz = (ssize_t)ectx->fw_info_strtab_sz; if (strtab == NULL) return NULL; @@ -610,7 +609,9 @@ nfp_elf_populate_fw_mip(struct nfp_elf *ectx, { uint8_t *pu8; const char *nx; + ssize_t tab_sz; uint64_t sh_size; + const char *str_tab; uint64_t sh_offset; uint32_t first_entry; const struct nfp_mip *mip; @@ -662,7 +663,9 @@ nfp_elf_populate_fw_mip(struct nfp_elf *ectx, } } - ectx->fw_mip.fw_typeid = nfp_elf_fwinfo_lookup(ectx, "TypeId"); + str_tab = ectx->fw_info_strtab; + tab_sz = (ssize_t)ectx->fw_info_strtab_sz; + ectx->fw_mip.fw_typeid = nfp_elf_fwinfo_lookup(str_tab, tab_sz, "TypeId"); /* * TypeId will be the last reserved key-value pair, so skip -- 2.39.1