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 7F3A7A00C4; Fri, 5 Aug 2022 11:04:13 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2A7D242C1E; Fri, 5 Aug 2022 11:04:13 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 27389400D5; Fri, 5 Aug 2022 11:04:10 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 2750OnCn011074; Fri, 5 Aug 2022 02:04:06 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=SEw0N5h/PIePeqR7uRY06scV8VQM4Ts/6LIDWkNNVbU=; b=P8QjGyaXA0DeDm+QkvhNXG9DdUPUzdprq5Txz958WvoE+1cxRx+bJNORDj2ABZJbb32M FB/bHBXMLvGp/nNFT8xYAH7oskxHj20fWX5sc+hd5Za3U55uzd05PvwxXBuGcdCUrQ50 9lOOCATwNbSshmBKBpJv35XWBJUiRNoEPN4291lzrwSAsaCaGN6O8MYdAfh1EaED+8dU mya7HR8UDw7Gj96b3va960kPWV2Pdf4lDACGM9g0odMof9rjTaHPLQYSUj8P2qziohh2 nEsnauXqpIV6Xhc8add3AS4DlVa4sz34FdgTbIFxacB31fkc4Y2Qd5Rlau4+hUXf9QLl Mg== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3hrg4ckdrs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Fri, 05 Aug 2022 02:04:06 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Fri, 5 Aug 2022 02:04:04 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Fri, 5 Aug 2022 02:04:04 -0700 Received: from localhost.localdomain (unknown [10.28.36.157]) by maili.marvell.com (Postfix) with ESMTP id E02D13F7094; Fri, 5 Aug 2022 02:04:02 -0700 (PDT) From: Amit Prakash Shukla To: Honnappa Nagarahalli , Konstantin Ananyev CC: , , Amit Prakash Shukla , Subject: [PATCH] ring: compilation fix with GCC-12 Date: Fri, 5 Aug 2022 14:33:48 +0530 Message-ID: <20220805090348.1947658-1-amitprakashs@marvell.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: HcDzrsFX95E2t6apQuNamUd32Ljgn4PP X-Proofpoint-ORIG-GUID: HcDzrsFX95E2t6apQuNamUd32Ljgn4PP X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-08-05_03,2022-08-04_02,2022-06-22_01 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 GCC 12 raises the following warning: In function '__rte_ring_dequeue_elems_128', inlined from '__rte_ring_dequeue_elems' at ../lib/ring/rte_ring_elem_pvt.h:262:3, inlined from '__rte_ring_do_hts_dequeue_elem' at ../lib/ring/rte_ring_hts_elem_pvt.h:237:3, inlined from 'rte_ring_mc_hts_dequeue_bulk_elem' at ../lib/ring/rte_ring_hts.h:83:9, inlined from 'rte_ring_dequeue_bulk_elem' at ../lib/ring/rte_ring_elem.h:391:10, inlined from 'rte_ring_dequeue_elem' at ../lib/ring/rte_ring_elem.h:476:9, inlined from 'rte_ring_dequeue' at ../lib/ring/rte_ring.h:463:9, inlined from 'rxa_intr_ring_dequeue' at ../lib/eventdev/rte_event_eth_rx_adapter.c:1196:10: ../lib/ring/rte_ring_elem_pvt.h:234:25: error: 'memcpy' writing 32 bytes into a region of size 8 overflows the destination [-Werror=stringop-overflow=] 234 | memcpy((void *)(obj + i), (void *)(ring + idx), 32); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Replacing memcpy with rte_memcpy fixes the GCC-12 compilation issue. Also it would be better to change to rte_memcpy as the function is called in fastpath. Bugzilla ID: 1062 Fixes: 1fc73390bcf5 ("ring: refactor exported headers") Cc: stable@dpdk.org Signed-off-by: Amit Prakash Shukla --- lib/ring/rte_ring_elem_pvt.h | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/lib/ring/rte_ring_elem_pvt.h b/lib/ring/rte_ring_elem_pvt.h index 83788c56e6..3d85b13333 100644 --- a/lib/ring/rte_ring_elem_pvt.h +++ b/lib/ring/rte_ring_elem_pvt.h @@ -10,6 +10,8 @@ #ifndef _RTE_RING_ELEM_PVT_H_ #define _RTE_RING_ELEM_PVT_H_ +#include + static __rte_always_inline void __rte_ring_enqueue_elems_32(struct rte_ring *r, const uint32_t size, uint32_t idx, const void *obj_table, uint32_t n) @@ -97,20 +99,20 @@ __rte_ring_enqueue_elems_128(struct rte_ring *r, uint32_t prod_head, const rte_int128_t *obj = (const rte_int128_t *)obj_table; if (likely(idx + n <= size)) { for (i = 0; i < (n & ~0x1); i += 2, idx += 2) - memcpy((void *)(ring + idx), + rte_memcpy((void *)(ring + idx), (const void *)(obj + i), 32); switch (n & 0x1) { case 1: - memcpy((void *)(ring + idx), + rte_memcpy((void *)(ring + idx), (const void *)(obj + i), 16); } } else { for (i = 0; idx < size; i++, idx++) - memcpy((void *)(ring + idx), + rte_memcpy((void *)(ring + idx), (const void *)(obj + i), 16); /* Start at the beginning */ for (idx = 0; i < n; i++, idx++) - memcpy((void *)(ring + idx), + rte_memcpy((void *)(ring + idx), (const void *)(obj + i), 16); } } @@ -231,17 +233,17 @@ __rte_ring_dequeue_elems_128(struct rte_ring *r, uint32_t prod_head, rte_int128_t *obj = (rte_int128_t *)obj_table; if (likely(idx + n <= size)) { for (i = 0; i < (n & ~0x1); i += 2, idx += 2) - memcpy((void *)(obj + i), (void *)(ring + idx), 32); + rte_memcpy((void *)(obj + i), (void *)(ring + idx), 32); switch (n & 0x1) { case 1: - memcpy((void *)(obj + i), (void *)(ring + idx), 16); + rte_memcpy((void *)(obj + i), (void *)(ring + idx), 16); } } else { for (i = 0; idx < size; i++, idx++) - memcpy((void *)(obj + i), (void *)(ring + idx), 16); + rte_memcpy((void *)(obj + i), (void *)(ring + idx), 16); /* Start at the beginning */ for (idx = 0; i < n; i++, idx++) - memcpy((void *)(obj + i), (void *)(ring + idx), 16); + rte_memcpy((void *)(obj + i), (void *)(ring + idx), 16); } } -- 2.25.1