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 97060A00C2 for ; Thu, 8 Dec 2022 15:55:57 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9280440E28; Thu, 8 Dec 2022 15:55:57 +0100 (CET) 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 648FC40A7E for ; Thu, 8 Dec 2022 15:55:56 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1670511356; 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=EGO7qXI2/FnYmMavBtJWwHOQNyMwiwXs0kVL6QXjE1M=; b=eS+hvmVmLm3MNMBuADXJLEFUMyKp2C9hzO4obIBr9Gm1SjQQ96zUYtkSH1aSr3w+SoPb14 H3FmIQdP4kE7ltHSuCIgK60iEiabPMlRfaRRuuFiPu+hle1Ar1CI89H4RoMjm7F0frJwjD jiRaFdZOm0akYa1TGoTb1zP80q3T25U= 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-34-Ir7LBUzINwmXJhFT76CAUA-1; Thu, 08 Dec 2022 09:55:52 -0500 X-MC-Unique: Ir7LBUzINwmXJhFT76CAUA-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 762D1806001; Thu, 8 Dec 2022 14:55:52 +0000 (UTC) Received: from localhost.localdomain (ovpn-194-246.brq.redhat.com [10.40.194.246]) by smtp.corp.redhat.com (Postfix) with ESMTP id A4C0B2024CC0; Thu, 8 Dec 2022 14:55:51 +0000 (UTC) From: David Marchand To: stable@dpdk.org Cc: bluca@debian.org, Stephen Hemminger Subject: [PATCH 20.11 4/4] crypto/ipsec_mb: fix build with GCC 12 Date: Thu, 8 Dec 2022 15:49:10 +0100 Message-Id: <20221208144910.360883-4-david.marchand@redhat.com> In-Reply-To: <20221208144910.360883-1-david.marchand@redhat.com> References: <20221208144910.360883-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 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 [ upstream commit 468f31eb71c4c2aa454841b316766514cabd0f02 ] GCC 12 raises the following warning: In function ‘__rte_ring_enqueue_elems_64’, inlined from ‘__rte_ring_enqueue_elems’ at ../lib/ring/rte_ring_elem_pvt.h:130:3, inlined from ‘__rte_ring_do_hts_enqueue_elem’ at ../lib/ring/rte_ring_hts_elem_pvt.h:196:3, inlined from ‘rte_ring_mp_hts_enqueue_burst_elem’ at ../lib/ring/rte_ring_hts.h:110:9, inlined from ‘rte_ring_enqueue_burst_elem’ at ../lib/ring/rte_ring_elem.h:577:10, inlined from ‘rte_ring_enqueue_burst’ at ../lib/ring/rte_ring.h:738:9, inlined from ‘process_op_bit’ at ../drivers/crypto/ipsec_mb/pmd_snow3g.c:425:16, inlined from ‘snow3g_pmd_dequeue_burst’ at ../drivers/crypto/ipsec_mb/pmd_snow3g.c:484:20: ../lib/ring/rte_ring_elem_pvt.h:68:44: error: array subscript 1 is outside array bounds of ‘struct rte_crypto_op[0]’ [-Werror=array-bounds] 68 | ring[idx + 1] = obj[i + 1]; | ~~~^~~~~~~ ../drivers/crypto/ipsec_mb/pmd_snow3g.c: In function ‘snow3g_pmd_dequeue_burst’: ../drivers/crypto/ipsec_mb/pmd_snow3g.c:434:1: note: at offset 8 into object ‘op’ of size 8 434 | snow3g_pmd_dequeue_burst(void *queue_pair, | ^~~~~~~~~~~~~~~~~~~~~~~~ Validate that one (exactly) op has been processed or return early. Fixes: b537abdbee74 ("crypto/snow3g: support bit-level operations") Signed-off-by: David Marchand Acked-by: Stephen Hemminger --- Note on backport: - applied change to kasumi and snow3g drivers, --- drivers/crypto/kasumi/rte_kasumi_pmd.c | 7 ++++--- drivers/crypto/snow3g/rte_snow3g_pmd.c | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/crypto/kasumi/rte_kasumi_pmd.c b/drivers/crypto/kasumi/rte_kasumi_pmd.c index 5ff1b5c562..cbf832f861 100644 --- a/drivers/crypto/kasumi/rte_kasumi_pmd.c +++ b/drivers/crypto/kasumi/rte_kasumi_pmd.c @@ -385,12 +385,13 @@ process_op_bit(struct rte_crypto_op *op, struct kasumi_session *session, op->sym->session = NULL; } - enqueued_op = rte_ring_enqueue_burst(qp->processed_ops, (void **)&op, - processed_op, NULL); + if (unlikely(processed_op != 1)) + return 0; + enqueued_op = rte_ring_enqueue(qp->processed_ops, op); qp->qp_stats.enqueued_count += enqueued_op; *accumulated_enqueued_ops += enqueued_op; - return enqueued_op; + return 1; } static uint16_t diff --git a/drivers/crypto/snow3g/rte_snow3g_pmd.c b/drivers/crypto/snow3g/rte_snow3g_pmd.c index 962868e1fc..2e2c8412ae 100644 --- a/drivers/crypto/snow3g/rte_snow3g_pmd.c +++ b/drivers/crypto/snow3g/rte_snow3g_pmd.c @@ -410,12 +410,13 @@ process_op_bit(struct rte_crypto_op *op, struct snow3g_session *session, op->sym->session = NULL; } - enqueued_op = rte_ring_enqueue_burst(qp->processed_ops, - (void **)&op, processed_op, NULL); + if (unlikely(processed_op != 1)) + return 0; + enqueued_op = rte_ring_enqueue(qp->processed_ops, op); qp->qp_stats.enqueued_count += enqueued_op; *accumulated_enqueued_ops += enqueued_op; - return enqueued_op; + return 1; } static uint16_t -- 2.38.1