From patchwork Thu Aug 4 13:40:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Prakash Shukla X-Patchwork-Id: 114615 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 7BDC9A00C4; Thu, 4 Aug 2022 15:41:24 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6FDA342BDE; Thu, 4 Aug 2022 15:41:24 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 5FB0D42BD9 for ; Thu, 4 Aug 2022 15:41:23 +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 27476C3R012676; Thu, 4 Aug 2022 06:41:22 -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-transfer-encoding : content-type; s=pfpt0220; bh=l6O5I44SeO9Wjx8UNipBJuBCJegZt8SwYL556+Gd7h8=; b=FJ5HfyZBfzjRedQEXayVV/tnj8aKEnLRX3qcMbl+31uWoa1LcFoGS0T8CMxUbac1xPoc NbpS3Ge9JBwhtD4luvj8QKfP2sY9SMFkBbk1RGzdlbOmBUX4NO1KfiXY87iQI3ARFzlz zzmJ61Jm2QHeUlS0oogxgpatWQl9YSNkHdTTtilS8F2QZBj13cyDm7GpmNjlZGO+Xd8g ggTZgw91ibpxtqCdUCBAWU6K/kmUt1S2qxUYDdFpB43goDcB7Ef53W7FXPdsOYAwoTDL mJ6virpNEF9P9GIF+174fl5qCfC/+8TNlagzx9ZiQF8unWpoUC68il47yvkEl/m5fFmA kQ== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3hqp04nt11-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 04 Aug 2022 06:41:22 -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; Thu, 4 Aug 2022 06:41:21 -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; Thu, 4 Aug 2022 06:41:21 -0700 Received: from localhost.localdomain (unknown [10.28.36.157]) by maili.marvell.com (Postfix) with ESMTP id 985B85B6941; Thu, 4 Aug 2022 06:41:19 -0700 (PDT) From: Amit Prakash Shukla To: Fan Zhang CC: , , Amit Prakash Shukla Subject: [PATCH 3/3] crypto/qat: compilation fix for GCC-12 Date: Thu, 4 Aug 2022 19:10:55 +0530 Message-ID: <20220804134055.1816993-3-amitprakashs@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220804134055.1816993-1-amitprakashs@marvell.com> References: <20220804134055.1816993-1-amitprakashs@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: A-i8gdbBucFQh9zNcdX5UCgYqmKayLYl X-Proofpoint-ORIG-GUID: A-i8gdbBucFQh9zNcdX5UCgYqmKayLYl 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-04_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: from ../lib/eal/x86/include/rte_vect.h:31, from ../lib/eal/x86/include/rte_memcpy.h:17, from ../drivers/crypto/qat/qat_sym_session.c:10: In function '_mm_storeu_si128', inlined from 'rte_mov16' at ../lib/eal/x86/include/rte_memcpy.h:508:2, inlined from 'rte_mov128' at ../lib/eal/x86/include/rte_memcpy.h:542:2, inlined from 'rte_memcpy_generic' at ../lib/eal/x86/include/rte_memcpy.h:732:4, inlined from 'rte_memcpy' at ../lib/eal/x86/include/rte_memcpy.h:882:10, inlined from 'qat_sym_do_precomputes.constprop' at ../drivers/crypto/qat/qat_sym_session.c:1434:2: /usr/lib/gcc/x86_64-pc-linux-gnu/12.1.1/include/emmintrin.h:739:8: error: array subscript 8 is outside array bounds of 'unsigned char[128]' [-Werror=array-bounds] 739 | *__P = __B; | ~~~~~^~~~~ ../drivers/crypto/qat/qat_sym_session.c: In function 'qat_sym_do_precomputes.constprop': ../drivers/crypto/qat/qat_sym_session.c:1305:17: note: at offset 192 into object 'opad.750' of size 128 1305 | uint8_t opad[qat_hash_get_block_size(ICP_QAT_HW_AUTH_ALGO_DELIMITER)]; | ^~~~ ../drivers/crypto/qat/qat_sym_session.c: In function 'qat_sym_do_precomputes.constprop': ../drivers/crypto/qat/qat_sym_session.c:1304:17: note: at offset 128 into object 'ipad.749' of size 128 1304 | uint8_t ipad[qat_hash_get_block_size(ICP_QAT_HW_AUTH_ALGO_DELIMITER)]; | ^~~~ Added a check to prevent compiler warnings. Signed-off-by: Amit Prakash Shukla Acked-by: Fan Zhang --- drivers/crypto/qat/qat_sym_session.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/crypto/qat/qat_sym_session.c b/drivers/crypto/qat/qat_sym_session.c index 8ca475ca8b..4c513186d4 100644 --- a/drivers/crypto/qat/qat_sym_session.c +++ b/drivers/crypto/qat/qat_sym_session.c @@ -1431,6 +1431,10 @@ static int qat_sym_do_precomputes(enum icp_qat_hw_auth_algo hash_alg, QAT_LOG(ERR, "invalid keylen %u", auth_keylen); return -EFAULT; } + + RTE_VERIFY(auth_keylen <= sizeof(ipad)); + RTE_VERIFY(auth_keylen <= sizeof(opad)); + rte_memcpy(ipad, auth_key, auth_keylen); rte_memcpy(opad, auth_key, auth_keylen);