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 D2773A0503 for ; Wed, 18 May 2022 12:17:51 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CB8E942823; Wed, 18 May 2022 12:17:51 +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 BCEBB42B8A for ; Wed, 18 May 2022 12:17:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1652869070; 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=kYkte8g+iQLXO5VsFitqTI3owdfv6sMTeeMCZFnmLGY=; b=IrBuII/rNfSjp3Dlr9q20P/2asegQc/pRuSpytIlIt0M04U5sMqP7d5T8BlT+gKHp5Ssx1 aUn2xjadLGYEBigu+d162u5xLJWMnd3QNWPX7qhquEOrnKMo92wUGBHQnnx1WTrtCOH2Ye fLcHGgvp8vlLdUxiAUkbAeDVdCMDrdY= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-562-yuv1_gaeNdCs6b96toT1-Q-1; Wed, 18 May 2022 06:17:45 -0400 X-MC-Unique: yuv1_gaeNdCs6b96toT1-Q-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 DFB541C06901; Wed, 18 May 2022 10:17:44 +0000 (UTC) Received: from fchome.home (unknown [10.40.195.61]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4C4CB401E98; Wed, 18 May 2022 10:17:40 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: thomas@monjalon.net, ferruh.yigit@xilinx.com, stable@dpdk.org, Apeksha Gupta , Sachin Saxena Subject: [PATCH 05/12] net/enetfec: fix build with GCC 12 Date: Wed, 18 May 2022 12:16:50 +0200 Message-Id: <20220518101657.1230416-6-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: ../drivers/net/enetfec/enet_ethdev.c: In function ‘enetfec_rx_queue_setup’: ../drivers/net/enetfec/enet_ethdev.c:473:9: error: array subscript 1 is above array bounds of ‘uint32_t[1]’ {aka ‘unsigned int[1]’} [-Werror=array-bounds] 473 | rte_write32(rte_cpu_to_le_32(fep->bd_addr_p_r[queue_idx]), | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 474 | (uint8_t *)fep->hw_baseaddr_v + ENETFEC_RD_START(queue_idx)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from ../drivers/net/enetfec/enet_ethdev.c:9: ../drivers/net/enetfec/enet_ethdev.h:113:33: note: while referencing ‘bd_addr_p_r’ 113 | uint32_t bd_addr_p_r[ENETFEC_MAX_Q]; | ^~~~~~~~~~~ This driver properly announces that it only supports 1 rxq. Silence this warning by adding an explicit check on the queue id. Cc: stable@dpdk.org Signed-off-by: David Marchand --- drivers/net/enetfec/enet_ethdev.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/net/enetfec/enet_ethdev.c b/drivers/net/enetfec/enet_ethdev.c index 714f8ac7ec..c938e58204 100644 --- a/drivers/net/enetfec/enet_ethdev.c +++ b/drivers/net/enetfec/enet_ethdev.c @@ -2,9 +2,12 @@ * Copyright 2020-2021 NXP */ +#include + #include #include #include + #include "enet_pmd_logs.h" #include "enet_ethdev.h" #include "enet_regs.h" @@ -454,6 +457,12 @@ enetfec_rx_queue_setup(struct rte_eth_dev *dev, return -EINVAL; } + if (queue_idx >= ENETFEC_MAX_Q) { + ENETFEC_PMD_ERR("Invalid queue id %" PRIu16 ", max %d\n", + queue_idx, ENETFEC_MAX_Q); + return -EINVAL; + } + /* allocate receive queue */ rxq = rte_zmalloc(NULL, sizeof(*rxq), RTE_CACHE_LINE_SIZE); if (rxq == NULL) { -- 2.36.1