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 85A8D432E6; Thu, 9 Nov 2023 16:54:13 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4CA0F4026B; Thu, 9 Nov 2023 16:54:13 +0100 (CET) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2040.outbound.protection.outlook.com [40.107.236.40]) by mails.dpdk.org (Postfix) with ESMTP id 2BACE4021E for ; Thu, 9 Nov 2023 16:54:11 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ggquwAdVE5QpDb5Fe2wujsrHP7C3Xa6tGlT5fh2MZignzMXZskxNPXzZADqfHn7ILsJ3VQVKi2g12nzSnG6+T1yHFeH8NazEHS0/Pi/LJ95BNTEsZ6IhzyBvJIz4bpgTPGuIvMM9QUytvZWSogGK45iX8Ny9cc7tiV+h+ZX3G2eps/JbctoZKm1acIDVVhLT0vlLeIlguFpX9S54ItbsNHTy3RnG9g8dnuOORbJolSz7p/mR9VvKVZwI1lKjAQ4bCwlhsLt64Rj4kXeNPMnYphm9GLVuNH6FGxHEFa1gPj6UcGF+Fs4KZZSnZyk+DnJn76uVVCMdvGStFgewHsNs6A== 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=907cnMqiymzBLuVZ0DZ5wvWyTasOx+V9Le3EFG2KVBg=; b=iWynLteTUEwtaHXQJzKG6FON5V8LQTnFHDmm4f8oll+XIZqC0hwMwCmUDk4q87iQzSTrNbSR3wjL2wtGFwC5Oovb2ikdIVJjiyDEj3ySD3c9oLm9N5LO2BosfenpwgXPFACuc74HLhwHNfCBit/ZIaA6iZyG00kdcLKiT3O3KY9Z/WI3kKeHfbIMHRba+kmOhAgCqHBl2A7e5q01alOCeLYk6vEO1n6QXkEO7m+mS/i0i1NGPkIdyzNXLAvaNghikH+iBA+QhpOelcTOrbhsaHGBcmyMxCyDk7WozqstpprbaEEGpNu8HvMVXgqKX2pTL3+yW4hnnZTcUylyCgMymg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=907cnMqiymzBLuVZ0DZ5wvWyTasOx+V9Le3EFG2KVBg=; b=NPr0Hb+Z3HYhvZ8Zyw/hOWF06rEI/cKKSITHd20WQtR2xBMsVNnBcF1+b6Gi3BKDN1B6UrQkltGaKpKX0Xok+c2e6MsC/7qFgnyyx7Rz20CBJeIVh5TeNTcjyyOs79jtT59EFMh8Ywfe3k3WRnFPt6QuOEa0HmNEoWZ+i9uUItI= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) by CH3PR12MB8534.namprd12.prod.outlook.com (2603:10b6:610:15a::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6977.19; Thu, 9 Nov 2023 15:54:09 +0000 Received: from CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::2569:edb2:670f:816f]) by CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::2569:edb2:670f:816f%6]) with mapi id 15.20.6954.029; Thu, 9 Nov 2023 15:54:08 +0000 Message-ID: Date: Thu, 9 Nov 2023 15:53:46 +0000 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] net/ena: fix coverity issues Content-Language: en-US To: "Brandes, Shai" Cc: "dev@dpdk.org" , "Beider, Ron" , "Atrash, Wajeeh" , "Bernstein, Amit" References: <20231109140816.2844-1-shaibran@amazon.com> <8015a2fcbd7b43cf97060ffa63d5acb5@amazon.com> From: Ferruh Yigit Autocrypt: addr=ferruh.yigit@amd.com; keydata= xsFNBGJDD3EBEAC/M7Tk/DfQSmP1K96vyzdhfSBzlCaGtcxNXorq4fALruqVsD3oi0yfyEz9 4YN8x7py0o9EL8ZdpOX0skc0AMCDAaw033uWhCn0GLMeGRKUbfOAPvL6ecSDvGD7CJIO9j0J eZUvasBgPdM/435PEr9DmC6Ggzdzt8IuG4PoLi5jpFSfcqxZFCCxLUDEo/w0nuguk2FTuYJg B2zEZ4JTBZrw7hIHiFh8D8hr6YA6a5uTofq1tr+l048lbtdFUl8TR0aIExVzE4Z8qKZlcE+9 RQaewjK5Al1jLE4sHdmd3GN+IvgDF3D/fLsi25SKJDeGSdeHkOmaX0qGeM4WKIfU6iARRCiQ N3AmBIxZ/A7UXBKLaOyZ+/i3sE6Wb53nrO4i8+0K2Qwyh6LjTeiJAIjYKN43ppxz3DaI+QwQ vI+uyHr4Gg0Da9EPPz/YyKauSeOZCfCB5gIfICO0j6x0SCl8uQ2nLpjxcZkf0gjcwUzP3h+S 3x6NfDji9YEij0zczW/dcSpGgZ6vsFpPrtnP9ZXy6J53yp0kJtOJoOlkEFFdU2yCZnCDseum CoudmGLZVvS0/DzHDJejq+3kK3FDGktZBOxZIIpal+nFqS7lVgOZc4+huVv3jyhzoAUOEyXA XK5j6o7g8STUY+z33QNnHpdLvecMwuzmvqy0jR54yAbZ64mB9QARAQABzSNGZXJydWggWWln aXQgPGZlcnJ1aC55aWdpdEBhbWQuY29tPsLBlwQTAQgAQQIbAwULCQgHAgYVCgkICwIEFgID AQIeAQIXgAIZARYhBEm7aYjps5XGsPHCElRTPtCKKm/6BQJkdyEEBQkE3meNAAoJE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ZNVM1l3NAdK+DLHqNxKuyO 8Zk= In-Reply-To: <8015a2fcbd7b43cf97060ffa63d5acb5@amazon.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: FR0P281CA0124.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:97::13) To CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PR12MB4294:EE_|CH3PR12MB8534:EE_ X-MS-Office365-Filtering-Correlation-Id: 6152780c-1d45-4e20-ab61-08dbe13c1be3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vh/HJQtyXBwlXzE+WP1Pcdk+0bQETlsbk2Cwj6lv41BdYXIJPJw3tSmFtZlZhx988HNm+Iudl5/DSO67Wy1zcLKhkijrbSAbLve3H0MKinpB8W2vWBvhMdlbAoisZf685QhYQ3y3s/kwMXjH6Cpf/nl5IbqfeUa8s5P47MgLs+x5Ro//B4ldCpHEhc/iaTEFf1/F042VF54OksYvvmiIleg+NWIpT1allJs/LdTjSiMytTeAF8f+vqy/adDDCW+w9AFffPUCSDtzuTdNpt8KJt5/aOnsJGFcF/91KG9P/EXoMP/kAv1/rKPy9dUylF9TRemEFdvDfGK8YSKYeDzRS6tVrx9s5h5fIwQcySGRpaLnQHp06Q/2CF/WkuTENRAVXE/YY0XlXsVW2ZvnY5TUUQ05gsHgpZsPsbSuJlKMm04Vjr5nNbnXLLhlR05fD2m/VSVORa2cOAPmHpb0U4MowzL0aU3hGxfrZh6uG58n7hcdwD9mK+NF2uFMEskUKxeT6iYg9LP+HAGAA626wCKsmTfKSOjuAKSQvLyHhZvLucnlHJY6jdUnAu7eXAIHDB8BmIWgBHjVGgcFOBeJ01xZW93rlU9WcwK8pq8AQ9bEymFi6I4m4xXtPgndbY+W3COTOizd9A8VNIZ8CCcHQ6fPh8gjbrlySr8FEzEkRkc9gP6vf5PEbEfWgNqQr5MjqlBr X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CH2PR12MB4294.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376002)(39860400002)(136003)(346002)(396003)(366004)(230173577357003)(230273577357003)(230922051799003)(186009)(451199024)(64100799003)(1800799009)(6512007)(31686004)(478600001)(53546011)(6486002)(6666004)(6506007)(26005)(6916009)(54906003)(83380400001)(66556008)(66476007)(316002)(38100700002)(66946007)(2616005)(5660300002)(44832011)(8676002)(4326008)(8936002)(41300700001)(36756003)(86362001)(31696002)(2906002)(43740500002)(45980500001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?ejJLV1h3eG1uWldMK2pHME03RnpVdU92aFBFczI2OXdGS1pFeW5PZHByNmx3?= =?utf-8?B?bmhmSXZYTXI0eGdIVVcwWExMRjlOakYxZG5uNEYrd2VoQWZZL3pFRlVxbHZF?= =?utf-8?B?aUxxQ09PM1RqODBFQ1dDa3U2QnJhTVd1RklUWkdtS1ZkWjl0OCt5ME16a3Vs?= =?utf-8?B?Vm0vblE0aHNzd3lZQlM1Q0FYYVRCb1ZGRExOSGtjNDdYWHJyMUMrNGxSZHZ2?= =?utf-8?B?RnlWN2RTUFl3UUVEZXY1STNNMkhkSTRYOE1TZ0NLS0l5VXNvSmZiRVZmU3p4?= =?utf-8?B?ME05VERaaVJsYzMvN1dIMFZZK3Vha21XY21uWXpOOTFtS0h2VU85QlBnZHIx?= =?utf-8?B?RlJDazI4eUJxMjU0VEw5YTdUVnJIWXVnemF4a2laUHY4cnkveHh4WEpJMllL?= =?utf-8?B?Ry81OWFtT2VWeTk2S1pMbGdCdEdFU0hldzE0U2M0WGpOL3lzeWNGZ2Y5eitD?= =?utf-8?B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STVz?= =?utf-8?B?RmhGT3A3RndYdlRWNURrMElXcXozbVpBaFlKK2FGRnZVeG9jaXRrbXFjRlZt?= =?utf-8?B?b1dDWU4reEhWT1U3VnNaOGZ0T291T3dQL0NNTG12UnJ4cHlReDlORjdSMFVi?= =?utf-8?B?cE5iTHNQTmVxdHFOdVM2SDF3dVpKam5JVndNM3NBaE5mN0FveVJjWGpqTlN0?= =?utf-8?B?N2plVEV1ODJIcm5na3loSHdqSVA3RU96TmFLZHhvVjdHNE0zaVdvZjFEd0Yz?= =?utf-8?B?U29RNytUTzRmSy93VGhScnJ3VDZvbFF0L3orWHAzeC9NZ2hFcUF6V3B0RmdM?= =?utf-8?B?cWhHbEh6K0ZydFhKZEs1TmU0ZG1ubGlKTm9mUDJYQktYbm53UHZLbUNUeUhP?= =?utf-8?B?MTgzc09QZUwra3prOHVURENWeG5IV2tGSDdYKzZDZ3RPcFdsREJEalMvOHFa?= =?utf-8?B?TlBXbitubUVWT05XV0IzVXZOWXUrZkpVNy9jWjdHSlFmOWJsam5NbkpuZGpo?= =?utf-8?B?RkQvWEIvbDNBZm8xU0pEWDJzU0I5R2ZzTWtyTm9la3JxazlrcEp3bUJ6Y3dl?= =?utf-8?B?Ti9DaUx5eXh4YUpra25xM3VJMDM1dzdRdUVON2pmYmpJOHRZV3h2Vzg3ejN6?= =?utf-8?B?Y2V4dGZHUFVUVFNSRHBOeXhOeDRjWlZWMHQxZVQ0WEJVZlVUTlQ4VmZ1MUQ5?= =?utf-8?B?VTc5MDlRY0lNSnVHaFUrd1d3Rm9SU3FZYjg1S1lkaXV5YkZHaUx4Rmt3Zld6?= =?utf-8?Q?A1BY=3D?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6152780c-1d45-4e20-ab61-08dbe13c1be3 X-MS-Exchange-CrossTenant-AuthSource: CH2PR12MB4294.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Nov 2023 15:54:08.7606 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: HyHJLDH2kolGu5FmDE9Ueko/3D3x6vnNBE+Pw7adi0iQgxxtLVfunICn4pfdbTOD X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB8534 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 11/9/2023 3:25 PM, Brandes, Shai wrote: > See inside > >> -----Original Message----- >> From: Ferruh Yigit >> Sent: Thursday, November 9, 2023 4:30 PM >> To: Brandes, Shai >> Cc: dev@dpdk.org; Beider, Ron ; Atrash, Wajeeh >> ; Bernstein, Amit >> Subject: RE: [EXTERNAL] [PATCH] net/ena: fix coverity issues >> >> CAUTION: This email originated from outside of the organization. Do not click >> links or open attachments unless you can confirm the sender and know the >> content is safe. >> >> >> >> On 11/9/2023 2:08 PM, shaibran@amazon.com wrote: >>> From: Shai Brandes >>> >>> Changed the rte_memcpy call to use the precomputed buf_size. >>> Rearranged the ena adapter structure and removed redundant '&' >>> operators as a precaution. >>> >> >> What is the reason of the structure rearrange? > [Brandes, Shai] Sorry, I should have included a cover letter to better explain the problem. > We debugged the Coverity issues and did not find any real issue, all addresses, lenghts and accesses were as expected (false-positive). > However, as precaution we decided to change few locations in the code that might have confused the Coverity but can easily worked around. > 1. In the case of the structure, we wanted to make sure that "metrics_stats" array and the "metrics_num" fields reside in the same cache line, > We originally set "uint64_t metrics_stats[ENA_MAX_CUSTOMER_METRICS] __rte_cache_aligned; " but setting this alignment on array (as opposed to structure for example) might have confused Coverity (I know it shouldn't be the case, but still...). > Switching the fields and setting the alignment on the "metrics_num" seems straight forward change and we verified with Pahole that both still reside in the same cache line (56 bytes total) and that the overall padding for both cases is identical (14B padding, just with different partition). > 2. The other problematic change was to remove some redundant "&" when providing memcpy with the address of the destination array ("&array" instead of just "array"). The "&" is not needed but should be harmless C-wise (double checked it by printing this array address both ways, with and without the "&"). Again, we suspect it might have confuses Coverity, so decided to go on the safe side. > Please acknowledge if these changes makes sense, and I will upload an updated patch. > > Got it, thanks for the clarification. There are a set of 'rte_memcpy' related coverity warnings, I assume it is because Coverity is confused from the 'rte_memcpy' implementation. You may be observing same warnings, didn't check. As far as I understand this patch has some refactoring but it is not clear if these changes will help coverity issue or not. In that case commit log needs to be updated and coverity tag needs to be removed, but changes are not functional or doesn't help development, perhaps changes can wait until related code updated for some functional reason. >> >> >>> Coverity issue: 405363 >>> Coverity issue: 405357 >>> Coverity issue: 405359 >>> >> >> Can you please split the patch per each fix if they are not logically related or >> caused from same code. > [Brandes, Shai] all cases are related to the same exact rte_memcpy line that allegedly access the source buffer at 160B offset although its length is 48B. > >> >>> Fixes: 92401abfbcb9 ("net/ena: support connection tracking stats") >>> Signed-off-by: Shai Brandes >>> --- >>> drivers/net/ena/ena_ethdev.c | 21 ++++++++++----------- >>> drivers/net/ena/ena_ethdev.h | 4 ++-- >>> 2 files changed, 12 insertions(+), 13 deletions(-) >>> >>> diff --git a/drivers/net/ena/ena_ethdev.c >>> b/drivers/net/ena/ena_ethdev.c index dc846d2e84..53e7251874 100644 >>> --- a/drivers/net/ena/ena_ethdev.c >>> +++ b/drivers/net/ena/ena_ethdev.c >>> @@ -531,8 +531,8 @@ ENA_PROXY_DESC(ena_com_get_eni_stats, >>> ENA_MP_ENI_STATS_GET, ({ >>> ENA_TOUCH(rsp); >>> ENA_TOUCH(ena_dev); >>> - if (stats != (struct ena_admin_eni_stats *)&adapter->metrics_stats) >>> - rte_memcpy(stats, &adapter->metrics_stats, sizeof(*stats)); >>> + if (stats != (struct ena_admin_eni_stats *)adapter->metrics_stats) >>> + rte_memcpy(stats, adapter->metrics_stats, >>> + sizeof(*stats)); >>> }), >>> struct ena_com_dev *ena_dev, struct ena_admin_eni_stats *stats); >>> >>> @@ -590,9 +590,8 @@ >> ENA_PROXY_DESC(ena_com_get_customer_metrics, >>> ENA_MP_CUSTOMER_METRICS_GET, ({ >>> ENA_TOUCH(rsp); >>> ENA_TOUCH(ena_dev); >>> - ENA_TOUCH(buf_size); >>> - if (buf != (char *)&adapter->metrics_stats) >>> - rte_memcpy(buf, &adapter->metrics_stats, adapter->metrics_num >> * sizeof(uint64_t)); >>> + if (buf != (char *)adapter->metrics_stats) >>> + rte_memcpy(buf, adapter->metrics_stats, buf_size); >>> }), >>> struct ena_com_dev *ena_dev, char *buf, size_t buf_size); >>> >>> @@ -3240,7 +3239,7 @@ static uint16_t eth_ena_xmit_pkts(void >>> *tx_queue, struct rte_mbuf **tx_pkts, } >>> >>> static void ena_copy_customer_metrics(struct ena_adapter *adapter, >> uint64_t *buf, >>> - size_t num_metrics) >>> + size_t num_metrics) >>> >> >> Please drop unrelated changed from the set. > [Brandes, Shai] ack >> >>> { >>> struct ena_com_dev *ena_dev = &adapter->ena_dev; >>> int rc; >>> @@ -3252,10 +3251,10 @@ static void ena_copy_customer_metrics(struct >> ena_adapter *adapter, uint64_t *buf >>> } >>> rte_spinlock_lock(&adapter->admin_lock); >>> rc = ENA_PROXY(adapter, >>> - ena_com_get_customer_metrics, >>> - &adapter->ena_dev, >>> - (char *)buf, >>> - num_metrics * sizeof(uint64_t)); >>> + ena_com_get_customer_metrics, >>> + &adapter->ena_dev, >>> + (char *)buf, >>> + num_metrics * sizeof(uint64_t)); >>> >> >> ditto > [Brandes, Shai] ack >> >>> rte_spinlock_unlock(&adapter->admin_lock); >>> if (rc != 0) { >>> PMD_DRV_LOG(WARNING, "Failed to get customer >>> metrics, rc: %d\n", rc); @@ -4088,7 +4087,7 @@ >> ena_mp_primary_handle(const struct rte_mp_msg *mp_msg, const void >> *peer) >>> case ENA_MP_CUSTOMER_METRICS_GET: >>> res = ena_com_get_customer_metrics(ena_dev, >>> (char *)adapter->metrics_stats, >>> - sizeof(uint64_t) * adapter->metrics_num); >>> + adapter->metrics_num * >>> + sizeof(uint64_t)); >>> >> >> Does above change makes any difference? What is the motivation? > [Brandes, Shai] No change, but I just wanted it to be in the same order as the other multiplications >> >> >>> break; >>> case ENA_MP_SRD_STATS_GET: >>> res = ena_com_get_ena_srd_info(ena_dev, diff --git >>> a/drivers/net/ena/ena_ethdev.h b/drivers/net/ena/ena_ethdev.h index >>> 4988fbffb5..17d292101c 100644 >>> --- a/drivers/net/ena/ena_ethdev.h >>> +++ b/drivers/net/ena/ena_ethdev.h >>> @@ -344,8 +344,8 @@ struct ena_adapter { >>> * Helper variables for holding the information about the supported >>> * metrics. >>> */ >>> - uint64_t metrics_stats[ENA_MAX_CUSTOMER_METRICS] >> __rte_cache_aligned; >>> - uint16_t metrics_num; >>> + uint16_t metrics_num __rte_cache_aligned; >>> + uint64_t metrics_stats[ENA_MAX_CUSTOMER_METRICS]; >>> struct ena_stats_srd srd_stats __rte_cache_aligned; }; >>> >