From patchwork Fri Jun 17 13:39:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ankur Dwivedi X-Patchwork-Id: 113008 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 989ABA0093; Fri, 17 Jun 2022 15:40:07 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8B44242823; Fri, 17 Jun 2022 15:40:07 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id F35FA40F19; Fri, 17 Jun 2022 15:40:05 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 25H3jumf020397; Fri, 17 Jun 2022 06:40:05 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=pfpt0220; bh=YqBnhaj7PQkmaIJ98ITnjp8enyCsMbAeROWPzmwfWto=; b=DFt0O4uY1eUSGb2KZab+hHIGZIU5hA0eOPuQWCuwEo48s89yHrs6wu20CXhWySysK5Ng 8JwLzp59c/Oq59FLNGaagbgnDcOEnE8pZLROxrC+3u2Y7CI5O+PAxUlC7GR+geWtJEJX DGFfOncTQm3HACLaRhnzTLrz3+LOF7pIU3xtD+huZA9v+JKJExnmRrUMMHFmme1nYvyM lPgKe8BTA8CAHRUddM0bK+z7dN8WFG4Vwpilj6Nl1ChgyX9moSQj3eQxYKNY2cytnij3 OVuPDN1l9gRK41rhYuRcKhUpOHdtmTOW4GVX3NNE+0g6Il8Xwy62Wd2ew2FWUQi7YNN7 mw== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3grj05syjj-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Fri, 17 Jun 2022 06:40:05 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 17 Jun 2022 06:40:03 -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, 17 Jun 2022 06:40:03 -0700 Received: from hyd1349.t110.caveonetworks.com.com (unknown [10.29.45.13]) by maili.marvell.com (Postfix) with ESMTP id 0D7EE3F7055; Fri, 17 Jun 2022 06:40:00 -0700 (PDT) From: Ankur Dwivedi To: CC: , , , , , Ankur Dwivedi , Subject: [PATCH v2 1/2] common/cpt: fix compilation with GCC 12 Date: Fri, 17 Jun 2022 19:09:29 +0530 Message-ID: <20220617133930.5063-2-adwivedi@marvell.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20220617133930.5063-1-adwivedi@marvell.com> References: <20220617061432.2685-1-adwivedi@marvell.com> <20220617133930.5063-1-adwivedi@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: MpXGGWSnGJ8m6GEmEgnVi9dgrlO9i9he X-Proofpoint-ORIG-GUID: MpXGGWSnGJ8m6GEmEgnVi9dgrlO9i9he X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.64.514 definitions=2022-06-17_08,2022-06-17_01,2022-02-23_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 The following warning is observed with GCC 12 compilation: In function ‘fill_sg_comp_from_iov’, inlined from ‘cpt_zuc_snow3g_enc_prep’ at ../drivers/common/cpt/cpt_ucode.h:1672:9, inlined from ‘cpt_fc_enc_hmac_prep’ at ../drivers/common/cpt/cpt_ucode.h:2472:3, inlined from ‘fill_digest_params’ at ../drivers/common/cpt/cpt_ucode.h:3548:14, inlined from ‘otx_cpt_enq_single_sym’ at ../drivers/crypto/octeontx/otx_cryptodev_ops.c:541:9, inlined from ‘otx_cpt_enq_single_sym_sessless’ at ../drivers/crypto/octeontx/otx_cryptodev_ops.c:584:8, inlined from ‘otx_cpt_enq_single’ at ../drivers/crypto/octeontx/otx_cryptodev_ops.c:611:11, inlined from ‘otx_cpt_pkt_enqueue’ at ../drivers/crypto/octeontx/otx_cryptodev_ops.c:643:9, inlined from ‘otx_cpt_enqueue_sym’ at ../drivers/crypto/octeontx/otx_cryptodev_ops.c:668:9: ../drivers/common/cpt/cpt_ucode.h:415:36: warning: array subscript 0 is outside array bounds of ‘buf_ptr_t[0]’ {aka ‘struct buf_ptr[]’} [-Warray-bounds] 415 | e_dma_addr = bufs[j].dma_addr; | ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ ../drivers/common/cpt/cpt_ucode.h:416:48: warning: array subscript 0 is outside array bounds of ‘buf_ptr_t[0]’ {aka ‘struct buf_ptr[]’} [-Warray-bounds] 416 | e_len = (size > bufs[j].size) ? | ~~~~~~~^~~~~ This patch resolves the warning. Bugzilla ID: 861 Fixes: 9be415daf469 ("common/cpt: add common defines for microcode") Fixes: b74652f3a91f ("common/cpt: add microcode interface for encryption") Cc: stable@dpdk.org Signed-off-by: Ankur Dwivedi Reviewed-by: Anoob Joseph Reviewed-by: Jerin Jacob Kollanukkaran --- drivers/common/cpt/cpt_mcode_defines.h | 2 +- drivers/common/cpt/cpt_ucode.h | 21 ++++++++++----------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/drivers/common/cpt/cpt_mcode_defines.h b/drivers/common/cpt/cpt_mcode_defines.h index f16ee44297..e6dcb7674c 100644 --- a/drivers/common/cpt/cpt_mcode_defines.h +++ b/drivers/common/cpt/cpt_mcode_defines.h @@ -387,7 +387,7 @@ typedef struct buf_ptr { /* IOV Pointer */ typedef struct{ int buf_cnt; - buf_ptr_t bufs[0]; + buf_ptr_t bufs[]; } iov_ptr_t; typedef struct fc_params { diff --git a/drivers/common/cpt/cpt_ucode.h b/drivers/common/cpt/cpt_ucode.h index e1f2f6005d..22aabab6ac 100644 --- a/drivers/common/cpt/cpt_ucode.h +++ b/drivers/common/cpt/cpt_ucode.h @@ -394,27 +394,26 @@ fill_sg_comp_from_iov(sg_comp_t *list, int32_t j; uint32_t extra_len = extra_buf ? extra_buf->size : 0; uint32_t size = *psize; - buf_ptr_t *bufs; - bufs = from->bufs; for (j = 0; (j < from->buf_cnt) && size; j++) { + phys_addr_t dma_addr = from->bufs[j].dma_addr; + uint32_t buf_sz = from->bufs[j].size; + sg_comp_t *to = &list[i >> 2]; phys_addr_t e_dma_addr; uint32_t e_len; - sg_comp_t *to = &list[i >> 2]; if (unlikely(from_offset)) { - if (from_offset >= bufs[j].size) { - from_offset -= bufs[j].size; + if (from_offset >= buf_sz) { + from_offset -= buf_sz; continue; } - e_dma_addr = bufs[j].dma_addr + from_offset; - e_len = (size > (bufs[j].size - from_offset)) ? - (bufs[j].size - from_offset) : size; + e_dma_addr = dma_addr + from_offset; + e_len = (size > (buf_sz - from_offset)) ? + (buf_sz - from_offset) : size; from_offset = 0; } else { - e_dma_addr = bufs[j].dma_addr; - e_len = (size > bufs[j].size) ? - bufs[j].size : size; + e_dma_addr = dma_addr; + e_len = (size > buf_sz) ? buf_sz : size; } to->u.s.len[i % 4] = rte_cpu_to_be_16(e_len); From patchwork Fri Jun 17 13:39:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ankur Dwivedi X-Patchwork-Id: 113009 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id CA955A0093; Fri, 17 Jun 2022 15:40:23 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BCD8C41614; Fri, 17 Jun 2022 15:40:23 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id C40B340F19; Fri, 17 Jun 2022 15:40:21 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 25H3lDTD023720; Fri, 17 Jun 2022 06:40:21 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=pfpt0220; bh=MTSugl4jhOAuuPWLX9BSu3v27HHbqiPXbEFMsETujys=; b=FcMuYUdyslRBfxnKncMkCxghM+RMQmojt89/2x9FpqqsgjXJdS5J/Cu60FjOtCk+Y6nF i8VYlV0H/3zlZGA5FozsuNpy+nwQ7/gxcAdN1JK5cGI4I5xP/JJdzufSO9iB6HqW7YF7 kF7sbOc/7p8RLZgfVMT/t9+Rmrqk74aUsvUxvRP6Xut8/E1rs8QC2G9jvdNhF7Er6hHN GgK7BCQ+9O/INzcUtwMtpuCs/QJ3wnuXm42smWQfEVP2gjKpPG0I7Ev7HOCmxrNMOdAP oN4kDkYOSthRpZJxSxFcm0S2O0q7mVn6wH8A+yQhUqNAzNoeidsE5yglkNa9bKI+apCl cw== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3grj05sykq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Fri, 17 Jun 2022 06:40:21 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 17 Jun 2022 06:40:19 -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, 17 Jun 2022 06:40:19 -0700 Received: from hyd1349.t110.caveonetworks.com.com (unknown [10.29.45.13]) by maili.marvell.com (Postfix) with ESMTP id A7E4D3F7086; Fri, 17 Jun 2022 06:40:14 -0700 (PDT) From: Ankur Dwivedi To: CC: , , , , , Ankur Dwivedi , Subject: [PATCH v2 2/2] crypto/cnxk: fix compilation with GCC 12 Date: Fri, 17 Jun 2022 19:09:30 +0530 Message-ID: <20220617133930.5063-3-adwivedi@marvell.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20220617133930.5063-1-adwivedi@marvell.com> References: <20220617061432.2685-1-adwivedi@marvell.com> <20220617133930.5063-1-adwivedi@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: r1TrX0M-3glsMsagVlnYAv_3_3_hXKUM X-Proofpoint-ORIG-GUID: r1TrX0M-3glsMsagVlnYAv_3_3_hXKUM X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.64.514 definitions=2022-06-17_08,2022-06-17_01,2022-02-23_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 The following warning is observed with GCC 12 compilation: In file included from ../drivers/crypto/cnxk/cn10k_cryptodev_ops.c:17: In function ‘fill_sg_comp_from_iov’, inlined from ‘cpt_pdcp_chain_alg_prep’ at ../drivers/crypto/cnxk/cnxk_se.h:1194:8, inlined from ‘cpt_fc_enc_hmac_prep’ at ../drivers/crypto/cnxk/cnxk_se.h:1871:9, inlined from ‘fill_digest_params’ at ../drivers/crypto/cnxk/cnxk_se.h:2829:8, inlined from ‘cpt_sym_inst_fill’ at ../drivers/crypto/cnxk/cn10k_cryptodev_ops.c:92:9, inlined from ‘cn10k_cpt_fill_inst.constprop’ at ../drivers/crypto/cnxk/cn10k_cryptodev_ops.c:146:10: ../drivers/crypto/cnxk/cnxk_se.h:222:52: warning: array subscript 0 is outside array bounds of ‘struct roc_se_buf_ptr[0]’ [-Warray-bounds] 222 | e_vaddr = (uint64_t)bufs[j].vaddr; | ~~~~~~~^~~~~~ ../drivers/crypto/cnxk/cnxk_se.h:223:48: warning: array subscript 0 is outside array bounds of ‘struct roc_se_buf_ptr[0]’ [-Warray-bounds] 223 | e_len = (size > bufs[j].size) ? bufs[j].size : size; | ~~~~~~~^~~~~ This patch resolves the warning. Fixes: 3de331795f73 ("crypto/cnxk: add flexi cipher encryption") Cc: stable@dpdk.org Signed-off-by: Ankur Dwivedi Reviewed-by: Anoob Joseph Reviewed-by: Jerin Jacob Kollanukkaran --- drivers/crypto/cnxk/cnxk_se.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/crypto/cnxk/cnxk_se.h b/drivers/crypto/cnxk/cnxk_se.h index a339b80a87..0833167586 100644 --- a/drivers/crypto/cnxk/cnxk_se.h +++ b/drivers/crypto/cnxk/cnxk_se.h @@ -188,27 +188,27 @@ fill_sg_comp_from_iov(struct roc_se_sglist_comp *list, uint32_t i, int32_t j; uint32_t extra_len = extra_buf ? extra_buf->size : 0; uint32_t size = *psize; - struct roc_se_buf_ptr *bufs; - bufs = from->bufs; for (j = 0; (j < from->buf_cnt) && size; j++) { + struct roc_se_sglist_comp *to = &list[i >> 2]; + uint32_t buf_sz = from->bufs[j].size; + void *vaddr = from->bufs[j].vaddr; uint64_t e_vaddr; uint32_t e_len; - struct roc_se_sglist_comp *to = &list[i >> 2]; if (unlikely(from_offset)) { - if (from_offset >= bufs[j].size) { - from_offset -= bufs[j].size; + if (from_offset >= buf_sz) { + from_offset -= buf_sz; continue; } - e_vaddr = (uint64_t)bufs[j].vaddr + from_offset; - e_len = (size > (bufs[j].size - from_offset)) ? - (bufs[j].size - from_offset) : + e_vaddr = (uint64_t)vaddr + from_offset; + e_len = (size > (buf_sz - from_offset)) ? + (buf_sz - from_offset) : size; from_offset = 0; } else { - e_vaddr = (uint64_t)bufs[j].vaddr; - e_len = (size > bufs[j].size) ? bufs[j].size : size; + e_vaddr = (uint64_t)vaddr; + e_len = (size > buf_sz) ? buf_sz : size; } to->u.s.len[i % 4] = rte_cpu_to_be_16(e_len);