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 BAB2A43CAB; Thu, 14 Mar 2024 08:07:05 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 07ECF42E7E; Thu, 14 Mar 2024 08:06:21 +0100 (CET) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2126.outbound.protection.outlook.com [40.107.220.126]) by mails.dpdk.org (Postfix) with ESMTP id 240CC42E7D; Thu, 14 Mar 2024 08:06:17 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gfsSABRciSeVxNCGuJpzOtvM8GuVyNKfZFpzjC5CQNZshzJlfEYK3uFZMZjhUl8lQOloG7U5e2XGe4WnMNzo4LBO15AE4oNsYrHZO50j7XaYuwtvtnK0IkvNzGMGp0PeQ/YDZKUGwQEJ3CWBeBM0y0IyLVZY85noO79/GAHTUf2VfqJ80pLQy+t+Yp7XuKIFBdRqbZk4m6mGeYiv55/MFC3u7dZAMSNA6Z0d5YOirwLaUh6f8ziWVsieqdXcg0PWcQAWsn1QknwFA2u//xkjoX5xssec7FIn+rNSW1ErrbUWr1NaiL4yxvDn3xg1PwK5zJ5V8Xvdy+S0339s8dZ4FQ== 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=B8MpdmJcXzMA/ImlIk72Mswk1WbFXbFr1kiEOZ2sGys=; b=A5jzBHNRtaF4UerY92xgQM2RSJEzB6UgxB0CGQRzaOtZAF8MHRx2yKblmMIhmA7CvFtE0t0p1vWJ2AMMnfIMzPxpzAQjkh7xRN6v3bQrf997micq0XKT2fUN4W5I91o3f9W7ksSys995EzuYxH9r2QMgBazDXaHVbDaCdEaHeqFRzerfueUZhMAfy3u1eQMVJysFLJS97jcYf11cmqJK9S0HOxGC2/g+JiGYHyq/PrjGpO5S66KRhdQi3TQIuIAvINCVNQqydmjIaALIEK2C3JGZR04Xe47SzJlGls9tqLZFb5o9LQtIZ7/Qqw191+KfRdr+jY6kxtBm6CL7SbRBqg== 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=B8MpdmJcXzMA/ImlIk72Mswk1WbFXbFr1kiEOZ2sGys=; b=S8pfXnya46xY1P5vm89ESwaSv5mOpcwy5tWX/WQVh0cgP7mA40Otl38Xo39QPlbRfNCLbtZ1UqijF+ZHoCJBFPdTvBO6wkhmG5uyxmGABEXXr/3wS5sPGAH0tOHIcpmzJ6FFlJketsniuD2XUtwv1YPOoBcqgTw1EUYjyVQmmIM= 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:15 +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:15 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Peng Zhang , stable@dpdk.org, Chaoyong He Subject: [PATCH 8/8] net/nfp: fix tainted scalar Date: Thu, 14 Mar 2024 15:05:36 +0800 Message-Id: <20240314070536.3169210-9-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: bdc251ae-35e9-436a-afc8-08dc43f53d47 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: i1iJpbak2hzwO0x1IZrhleM0ulxMy9bDl2/D9srRX4AudWofXTUFwVqTd5G+con2D0OMhOrB/75YngObEt/9pyZD1KkPXBw0lKbEPMO6hA5vxRLJGyB1YKwD2bB04POxkka3erfZd56buPQIhXS3oHYOWGNdwDhMHSEtptQEviOWeVKBtDt44V9tYTlcycCMzDaOL53aGGcqsg7URd03CHhf4N6eUn/8+hedZwbedaFGXS1bCczfoUEZumq5eO0xNQymGQfhxsrxT4qG5znsRYll/1n3uX0zhYPk6pE9SamjHaNW362cIdvcoQNv66W3A+C9RevPycpJT9+FAVCBfiRGvOHvXqp5Jz6OTalGn24BVrOveKnzLkSa+VBh6OjjANrEjHFvTA8PyyzbHS1EhT+2K1kPd7OPAR6URiviAlRJ2v2SDKxJ6V7sWVE39EE+fClpjhGKZyu1yeL6An4oOzjIDg7Hzx6eFq/K0w3rizdfkMuJcWhtAAiueczl/dgXWBPRuOVeuMXzZpeh0dqnq5kbeEznnhNRZIsXOvl5XD+TjJ+flgm3LXzCTGrkStcb+OC+f3rdVQgvfDwQLm48BbXnGJy8MAacOpODLxUcorHiPCsmJDyXSizTAxnGKZ1ZCdqShzm9LrN9r3JGodQlexUEfcSEgfRn1DrC5W8rudObYrGuEoG6sTGAhRDMbzHWjTf5x/OsKbeKIfVo8aXaRarw//LjvKGiFT6RmsHtxdw= 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?7JT31gOi+fRaJCxjN9zhkZjVNb77yjbetK0BPeBvZ9ZrLzXjHa/TuPiKPkqq?= =?us-ascii?Q?tY7py/AM+hqKy1pIv8U+1cgvwpekzQXAYWrAutGqhIysoZEChYYRrmZOb3jF?= =?us-ascii?Q?jeqoO8BqwbYr/0HfNdm1Thh1TXabQb4SPewpDyTLFdZXegQD1IejT1tBgouY?= =?us-ascii?Q?XtziKZyx/MKMPTLhP24/dt0zMX9L28goFHCqCu4SRKWAee4Hz0DpQNDH40yz?= =?us-ascii?Q?Zj+ZnWDgUhDdIUn23eI7pqnQ+3e7t91XOjF6A16dDrywLZB/3QEuBRlNnq6H?= =?us-ascii?Q?8ifCNmJhXjN9Q2j0tGRjKpJan9JN0+QAY5VQdwYKfNVGKMLNwN7//53loR5s?= =?us-ascii?Q?cL8bKCWi6j53KCbY5oERvSpLKB9xBRHejqFliFuSH2hpaGc9t3aDOsNpzonI?= =?us-ascii?Q?+lxxiK4ftRW6VazGXUvP9dnqkmwfsDW1wIzxW6xwQv3PU6c7HxRvVCic/VBt?= =?us-ascii?Q?a9i7HV9cV4FR1RW8k8xupT+ZaOV/74NGqD/pLhS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wLoW7az4mKnswVuKe1qRZiYdUsz2M25eweitG1RuzgwauC+cJKNxXnZI+?= =?us-ascii?Q?ky2t3Hf30AoKgTAWnkn2/UYhDy0YzS8Vib8bRAg5d+Z6A9HzB+wCgQsOVLpz?= =?us-ascii?Q?WNHRdOr6J9SdOMV7vxGtY0/cCTJOgk/NGM81bUuO8D0l+tBi1ZVs5PSaxm0Z?= =?us-ascii?Q?sQ7cCkLbMT1uZvpNVQCuazUzstFAavZuYkvwNN1nVSiNAcOWcxbdqUkA/LGd?= =?us-ascii?Q?Aw=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: bdc251ae-35e9-436a-afc8-08dc43f53d47 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:15.6127 (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: m8egX624jOJrnl2l9CNqesrhO3SwrfQFCDviIy4ULfZnk6TKoVCXzOFlJ6vKr+zBoB9j9Pd+9hPS/t+pU6nP6Brq1mPUAihvlWJURLhnhQs= 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 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 268cdb1aff..fab9b68801 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