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 4380DA0503; Fri, 20 May 2022 17:04:50 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DE39F40222; Fri, 20 May 2022 17:04:49 +0200 (CEST) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2049.outbound.protection.outlook.com [40.107.237.49]) by mails.dpdk.org (Postfix) with ESMTP id 3D10140156; Fri, 20 May 2022 17:04:49 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=T/4so6MKJVowULH242HFuaaFMg6jw+7Dxq1QTNP7/HX5b/yGYOKX0AjsQbiUyezQHMb49alYw8MewSVXZ9sNDc/d5qW5jyEzRvb7pwMDeEkvXw2WIKhvMLDXg5Uv+GH8AvDtacEspgEIohkDqclIyKtAktvvUhQXS+IA/sDoVg9R4R+udK3bWFOvgO0+HOiKEp5QD4OXl+hW/Td2EkLAKb/jaMO6YNEbgC+RghwASXHsis+hxQ1wKzMSJDf+eV69yNMUXIsfU2bSQmLrLIekXlcv5Dm8SHOfl9AqNuaqwzCXeokSfZKr/S3VBYhPdCFS5cKTbRnFCxnsBfzDxROnaQ== 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=j/Kgi+XOB0V8RKTU2qtGys8siNQEJxH0YiMXumAbrqM=; b=aZ9zRxF+IM9sEHWDSSFueteLFCOwCoe5kXvQ5KUmrEHjN1k+Qs/FPZZu17Ejn6euVg0WVw3dV7Oelj5XGDNdrArU2ETuYbpveI2CTV8nYEwx5M/W8D2zhyoecjz42EiY8cjBxyd0EBk0jz9ykGaG3UU2kaaW9Pv9b7RqTE+an1eXE5GtXD9GZCD4v7mhEg1Td19Lx/uiOZv9zlSDD24R50ARMxiTNNei5tLr6SUEIY4m2xeu399HmYQeb8M0PO+CK+4j4Uy75LO7X3bHOnBWWCzPzhh+3QDKcYl7NskDmf0g0uOZNbyFS9rhgF4Py8xMnuQNb7dtoVIPkz7ua1thPQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=softfail (sender ip is 149.199.80.198) smtp.rcpttodomain=redhat.com smtp.mailfrom=amd.com; dmarc=fail (p=quarantine sp=quarantine pct=100) action=quarantine header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=j/Kgi+XOB0V8RKTU2qtGys8siNQEJxH0YiMXumAbrqM=; b=fVduw7DWTt/LeO9kkbZ36cUJDbaRCg15v2o9LytEwxD31WXJWP5FvON8NLOzhPl/Wq1CMWpLo645bwDU9vYWFvMIq7XL3rpSXcVM+JreghOsrZIMN9T16cYj4CGAPBRFJcsBUCJiu4stujoTxc3MsgCRfY6pX2F1yNzJuSa1NWA= Received: from DM6PR06CA0039.namprd06.prod.outlook.com (2603:10b6:5:54::16) by DM6PR02MB5356.namprd02.prod.outlook.com (2603:10b6:5:4f::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5273.16; Fri, 20 May 2022 15:04:47 +0000 Received: from DM3NAM02FT005.eop-nam02.prod.protection.outlook.com (2603:10b6:5:54:cafe::32) by DM6PR06CA0039.outlook.office365.com (2603:10b6:5:54::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.18 via Frontend Transport; Fri, 20 May 2022 15:04:47 +0000 X-MS-Exchange-Authentication-Results: spf=softfail (sender IP is 149.199.80.198) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=fail action=quarantine header.from=amd.com; Received-SPF: SoftFail (protection.outlook.com: domain of transitioning amd.com discourages use of 149.199.80.198 as permitted sender) Received: from xir-pvapexch02.xlnx.xilinx.com (149.199.80.198) by DM3NAM02FT005.mail.protection.outlook.com (10.13.5.123) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5273.14 via Frontend Transport; Fri, 20 May 2022 15:04:46 +0000 Received: from xir-pvapexch02.xlnx.xilinx.com (172.21.17.17) by xir-pvapexch02.xlnx.xilinx.com (172.21.17.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.14; Fri, 20 May 2022 16:04:45 +0100 Received: from smtp.xilinx.com (172.21.105.197) by xir-pvapexch02.xlnx.xilinx.com (172.21.17.17) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Fri, 20 May 2022 16:04:45 +0100 Envelope-to: david.marchand@redhat.com, thomas@monjalon.net, dev@dpdk.org, stable@dpdk.org, orika@nvidia.com, xiaoyun.li@intel.com, aman.deep.singh@intel.com, yuying.zhang@intel.com, wei.zhao1@intel.com Received: from [10.71.119.221] (port=4833) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1ns4BJ-00020H-LJ; Fri, 20 May 2022 16:04:45 +0100 Message-ID: <6817fb03-bf0d-89d2-774f-104fc247cb0b@amd.com> Date: Fri, 20 May 2022 16:04:45 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: Re: [PATCH] app/testpmd: remove useless pointer checks Content-Language: en-US To: David Marchand , Thomas Monjalon CC: dev , dpdk stable , Ori Kam , Xiaoyun Li , Aman Singh , Yuying Zhang , Wei Zhao References: <20220324161503.13047-1-david.marchand@redhat.com> <7495551.lvqk35OSZv@thomas> From: Ferruh Yigit In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8612222a-0338-4c31-1433-08da3a721481 X-MS-TrafficTypeDiagnostic: DM6PR02MB5356:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 2 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: l3KJ90ASV+NxCs+rIrI8PslD+c2H07foNRqbkVFLCIVaIuKM9wybWZh3aLLoNhKfai155Br11gwmMXhTj9qpjFAszCHQ0aqv/2kaNEwBGDTBlXCP3+68kvhpahb31IfR6k2aw9xqF7KMgp7DqsOhlZCcgRTRrX2UTNtHsikhRsvKqsn8DXM5j7ENfE9V/Af5w2Wzdx7YzOlSiqpX3pMRVm5uyFFVEPOBx+t6h6eRJ3qnoY/xvd6EJ4x5OcWq4ljQ/sTyBduJjoA66GzbIuZIq7al7dsQghyokZtTC5PWk8Qpi8GhwMkhIjFo8wcWaa8nWevENITtdQEfc9toVMVdLc+yzGBTYcUWE8Z0Flhxe0owp/b+TVHK1/B4Lx0fphsNZ8eCVO8SNWlyubdyKrncU/1vFW+GCi6MmR/aygF2om5+0Cfbr3rV44L9VnIEDQMNDhJbFb13yBDJKjhy9YzWykGNp20Uhykj3yO+yyv5/A3Srq35r9eOKx/RlQo5eaQ7sXp2dcfLzIFGAS5gv0ZxGksbvafkMwNj8MtKOygzEpjsHuQjQ7Wnzxx9Xc57qMQadTBP3z1xvowpMpvuI3n8G6HifpbGZK18gGzf8pD4patDAFOQVzOLaR9I73W3sK2XCaYjm2q4xchbu5Os2zGqTOaVPp4IOwzvPJe1+p7bgbCSXF5kqagfmUm1L0P98cDjnxyAQZn1KnqHXU+wb2lI3y768RMEvxCin1M54KQ4YcQ= X-Forefront-Antispam-Report: CIP:149.199.80.198; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:xir-pvapexch02.xlnx.xilinx.com; PTR:unknown-80-198.xilinx.com; CAT:NONE; SFS:(13230001)(4636009)(40470700004)(46966006)(9786002)(2616005)(31696002)(44832011)(86362001)(70586007)(70206006)(5660300002)(508600001)(8936002)(26005)(8676002)(4326008)(35950700001)(336012)(40460700003)(31686004)(356005)(47076005)(7636003)(2906002)(82310400005)(53546011)(316002)(54906003)(36756003)(110136005)(50156003)(43740500002); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.onmicrosoft.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 May 2022 15:04:46.8689 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8612222a-0338-4c31-1433-08da3a721481 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.80.198]; Helo=[xir-pvapexch02.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: DM3NAM02FT005.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR02MB5356 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 On 5/12/2022 8:19 AM, David Marchand wrote: > On Tue, Mar 29, 2022 at 11:26 AM Thomas Monjalon wrote: >> >> 24/03/2022 17:15, David Marchand: >>> Parameters to this static helper can't be NULL. >>> str has already been dereferenced in caller. >>> dst and size point to variable in stack. >> >> The same function is copy/pasted in several places. >> Why simplifying only this one? because of its static nature? >> >> Shouldn't we make it a common function as other string helpers? > > Sorry, this thread fell through the cracks. > > The issue was raised by covscan: > > Error: REVERSE_INULL (CWE-476): > dpdk-21.11/app/test-pmd/cmdline_flow.c:7705: deref_ptr: Directly > dereferencing pointer "size". > dpdk-21.11/app/test-pmd/cmdline_flow.c:7711: check_after_deref: > Null-checking "size" suggests that it may be null, but it has already > been dereferenced on all paths leading to the check. > # 7709| if ((src == NULL) || > # 7710| (dst == NULL) || > # 7711|-> (size == NULL) || > # 7712| (*size == 0)) > # 7713| return -1; > > > As for the rest of the code, there might be more cleanups to do, as followups. > Proceeding with this one as it solves coverity issue, Applied to dpdk-next-net/main, thanks.