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 E5D4AA0503 for ; Wed, 18 May 2022 12:18:32 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CCEF040156; Wed, 18 May 2022 12:18:32 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 8D77E40156 for ; Wed, 18 May 2022 12:18:31 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1652869111; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7lx4sCx/tZfITgMdJHK1HRFZ4nY1QrJKbQ7ev6u8dtQ=; b=PYHPbdWS+B41EJqNAPG5l24m5Qial8OU10tCnjuV4dp7XZOgPg0LJPoxfkk8kAmwhT3yx+ yZK2H4EBW0LzLquS4L5qpwL0++WqpiZdgkdAH3cY3qhPuddzXgRlpdSNjo8aysQPBJI4bV o+gD1DCAQYrHjV5VYjOHFdEh6lvxx2w= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-342-wykL6s0CPxWGCtkMnnrfHA-1; Wed, 18 May 2022 06:18:28 -0400 X-MC-Unique: wykL6s0CPxWGCtkMnnrfHA-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AF81D8117B0; Wed, 18 May 2022 10:18:27 +0000 (UTC) Received: from fchome.home (unknown [10.40.195.61]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4C92A492C14; Wed, 18 May 2022 10:18:24 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: thomas@monjalon.net, ferruh.yigit@xilinx.com, stable@dpdk.org, Konstantin Ananyev , Bernard Iremonger , Vladimir Medvedkin Subject: [PATCH 12/12] test/ipsec: fix build with GCC 12 Date: Wed, 18 May 2022 12:16:57 +0200 Message-Id: <20220518101657.1230416-13-david.marchand@redhat.com> In-Reply-To: <20220518101657.1230416-1-david.marchand@redhat.com> References: <20220518101657.1230416-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=david.marchand@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org GCC 12 raises the following warning: In function ‘_mm256_loadu_si256’, inlined from ‘rte_mov32’ at ../lib/eal/x86/include/rte_memcpy.h:319:9, inlined from ‘rte_mov128’ at ../lib/eal/x86/include/rte_memcpy.h:344:2, inlined from ‘rte_memcpy_generic’ at ../lib/eal/x86/include/rte_memcpy.h:438:4, inlined from ‘rte_memcpy’ at ../lib/eal/x86/include/rte_memcpy.h:882:10, inlined from ‘setup_test_string.constprop’ at ../app/test/test_ipsec.c:572:4: /usr/lib/gcc/x86_64-redhat-linux/12/include/avxintrin.h:929:10: error: array subscript ‘__m256i_u[3]’ is partly outside array bounds of ‘const char[108]’ [-Werror=array-bounds] 929 | return *__P; | ^~~~ ../app/test/test_ipsec.c: In function ‘setup_test_string.constprop’: ../app/test/test_ipsec.c:539:12: note: at offset 96 into object ‘null_plain_data’ of size 108 539 | const char null_plain_data[] = | ^~~~~~~~~~~~~~~ Split copy request into copies of string lengths and remove unused blocksize. Cc: stable@dpdk.org Signed-off-by: David Marchand --- app/test/test_ipsec.c | 48 ++++++++++++++++++++++++++----------------- 1 file changed, 29 insertions(+), 19 deletions(-) diff --git a/app/test/test_ipsec.c b/app/test/test_ipsec.c index 8da025bf66..d7455fd021 100644 --- a/app/test/test_ipsec.c +++ b/app/test/test_ipsec.c @@ -554,24 +554,28 @@ struct rte_ipv4_hdr ipv4_outer = { }; static struct rte_mbuf * -setup_test_string(struct rte_mempool *mpool, - const char *string, size_t len, uint8_t blocksize) +setup_test_string(struct rte_mempool *mpool, const char *string, + size_t string_len, size_t len) { struct rte_mbuf *m = rte_pktmbuf_alloc(mpool); - size_t t_len = len - (blocksize ? (len % blocksize) : 0); if (m) { memset(m->buf_addr, 0, m->buf_len); - char *dst = rte_pktmbuf_append(m, t_len); + char *dst = rte_pktmbuf_append(m, len); if (!dst) { rte_pktmbuf_free(m); return NULL; } - if (string != NULL) - rte_memcpy(dst, string, t_len); - else - memset(dst, 0, t_len); + if (string != NULL) { + size_t off; + + for (off = 0; off + string_len < len; off += string_len) + rte_memcpy(&dst[off], string, string_len); + rte_memcpy(&dst[off], string, len % string_len); + } else { + memset(dst, 0, len); + } } return m; @@ -1365,7 +1369,8 @@ test_ipsec_crypto_outb_burst_null_null(int i) /* Generate input mbuf data */ for (j = 0; j < num_pkts && rc == 0; j++) { ut_params->ibuf[j] = setup_test_string(ts_params->mbuf_pool, - null_plain_data, test_cfg[i].pkt_sz, 0); + null_plain_data, sizeof(null_plain_data), + test_cfg[i].pkt_sz); if (ut_params->ibuf[j] == NULL) rc = TEST_FAILED; else { @@ -1483,7 +1488,8 @@ test_ipsec_inline_crypto_inb_burst_null_null(int i) /* Generate test mbuf data */ ut_params->obuf[j] = setup_test_string( ts_params->mbuf_pool, - null_plain_data, test_cfg[i].pkt_sz, 0); + null_plain_data, sizeof(null_plain_data), + test_cfg[i].pkt_sz); if (ut_params->obuf[j] == NULL) rc = TEST_FAILED; } @@ -1551,16 +1557,17 @@ test_ipsec_inline_proto_inb_burst_null_null(int i) /* Generate inbound mbuf data */ for (j = 0; j < num_pkts && rc == 0; j++) { - ut_params->ibuf[j] = setup_test_string( - ts_params->mbuf_pool, - null_plain_data, test_cfg[i].pkt_sz, 0); + ut_params->ibuf[j] = setup_test_string(ts_params->mbuf_pool, + null_plain_data, sizeof(null_plain_data), + test_cfg[i].pkt_sz); if (ut_params->ibuf[j] == NULL) rc = TEST_FAILED; else { /* Generate test mbuf data */ ut_params->obuf[j] = setup_test_string( ts_params->mbuf_pool, - null_plain_data, test_cfg[i].pkt_sz, 0); + null_plain_data, sizeof(null_plain_data), + test_cfg[i].pkt_sz); if (ut_params->obuf[j] == NULL) rc = TEST_FAILED; } @@ -1660,7 +1667,8 @@ test_ipsec_inline_crypto_outb_burst_null_null(int i) /* Generate test mbuf data */ for (j = 0; j < num_pkts && rc == 0; j++) { ut_params->ibuf[j] = setup_test_string(ts_params->mbuf_pool, - null_plain_data, test_cfg[i].pkt_sz, 0); + null_plain_data, sizeof(null_plain_data), + test_cfg[i].pkt_sz); if (ut_params->ibuf[0] == NULL) rc = TEST_FAILED; @@ -1738,15 +1746,16 @@ test_ipsec_inline_proto_outb_burst_null_null(int i) /* Generate test mbuf data */ for (j = 0; j < num_pkts && rc == 0; j++) { ut_params->ibuf[j] = setup_test_string(ts_params->mbuf_pool, - null_plain_data, test_cfg[i].pkt_sz, 0); + null_plain_data, sizeof(null_plain_data), + test_cfg[i].pkt_sz); if (ut_params->ibuf[0] == NULL) rc = TEST_FAILED; if (rc == 0) { /* Generate test tunneled mbuf data for comparison */ ut_params->obuf[j] = setup_test_string( - ts_params->mbuf_pool, - null_plain_data, test_cfg[i].pkt_sz, 0); + ts_params->mbuf_pool, null_plain_data, + sizeof(null_plain_data), test_cfg[i].pkt_sz); if (ut_params->obuf[j] == NULL) rc = TEST_FAILED; } @@ -1815,7 +1824,8 @@ test_ipsec_lksd_proto_inb_burst_null_null(int i) for (j = 0; j < num_pkts && rc == 0; j++) { /* packet with sequence number 0 is invalid */ ut_params->ibuf[j] = setup_test_string(ts_params->mbuf_pool, - null_encrypted_data, test_cfg[i].pkt_sz, 0); + null_encrypted_data, sizeof(null_encrypted_data), + test_cfg[i].pkt_sz); if (ut_params->ibuf[j] == NULL) rc = TEST_FAILED; } -- 2.36.1