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 2C31FA0548; Tue, 7 Jun 2022 19:18:25 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8770942B71; Tue, 7 Jun 2022 19:17:58 +0200 (CEST) Received: from mail-pg1-f173.google.com (mail-pg1-f173.google.com [209.85.215.173]) by mails.dpdk.org (Postfix) with ESMTP id 7586A427F9 for ; Tue, 7 Jun 2022 19:17:57 +0200 (CEST) Received: by mail-pg1-f173.google.com with SMTP id e66so16441543pgc.8 for ; Tue, 07 Jun 2022 10:17:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=v0BjNk3Yz37J2Q4R6FxCCt/dtl81KLrgAoXeaqP2Jbk=; b=XZ+thQ+zuXKN5TKwTdVmXhaVNbzK1BOUJ4mQorNs2wzn7aChaGKG0XoCY2sI+ITost ZHTw95OWWp+ZvHqOZh/cMwyO6MOAY7G17mxoMXKtATa7JhSSKez5fkGQbQ83p+9nUBjz EgUHwHKJ8ZVo674O6LK1AIdw0eL9GjGcTGqEvsPABlfnUjGs4QzMlVuV6wgDLdyqQUny AE+BEtkWWnbcXjnYa4iFM5p4vhy3mVx0V5yTVG2OMIsciYOuFzTQhN+iNCdOthpEKNBc GwvP2XSwD14dbjC8rCHcHNub/Epw+LJNgHo9YeigE1/aAWapdEAPnofaJ+EkRavYYKWC HGvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=v0BjNk3Yz37J2Q4R6FxCCt/dtl81KLrgAoXeaqP2Jbk=; b=lqyzth9nwKpGLlAvabhhJ38UdMisTN/lbAUkrQZh/Agn/eZWEEGo5CRZFC1GU9mxv1 iUkMr6Poi9PGlyjxiPAfk5iUWvnoBEdB39dPVvlgEwBjFl9dBjMsMlMKRi00e7NBwR4v HzW5gaDulwmQGqTrkZ0yijxLvs9Yj3ZT6hkcqjcR7xWNrr+GPOnK0LrPpGip231u7QXT m6sPDeuYwRtVDmZrfk1ENBHQZ4DgayjLgh8GWcgw8jNFP4D4A3eNw9+0Nol9Ge16DPDb yAPG9eTqdPHEUDWyMQ2JvtY+v4k3x0z0X4WaF1VnmBKeG77t7WQrevAeM/WlspW/8cVR w1/Q== X-Gm-Message-State: AOAM532NlIOh7kbvGxSi9Y/FXjvxTxwZy2bzAkqRItzsqaRkim3UYgoB 1qGExuUt/hodCMlR/RpXCnIMl5a+8TjRVw== X-Google-Smtp-Source: ABdhPJyg/y+b1bGC0DmvAzYTe3S90xY5ruGvp5+/tYgAJsL4tAfb1+w5PUZY/GInxsKA9GFlmRI4Gg== X-Received: by 2002:a62:1553:0:b0:51b:e0fe:ea34 with SMTP id 80-20020a621553000000b0051be0feea34mr23303165pfv.23.1654622276117; Tue, 07 Jun 2022 10:17:56 -0700 (PDT) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id x2-20020a627c02000000b005087c23ad8dsm13185281pfc.0.2022.06.07.10.17.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 10:17:55 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Apeksha Gupta , Sachin Saxena Subject: [RFC 6/8] net/enetfc: fix array out of bounds warning Date: Tue, 7 Jun 2022 10:17:44 -0700 Message-Id: <20220607171746.461772-7-stephen@networkplumber.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220607171746.461772-1-stephen@networkplumber.org> References: <20220607171746.461772-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 With gcc-12 it detects that this function could be passed a queue > 1 which would cause out of bounds access. Signed-off-by: Stephen Hemminger --- drivers/net/enetfec/enet_ethdev.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/enetfec/enet_ethdev.c b/drivers/net/enetfec/enet_ethdev.c index 714f8ac7eccc..4956235a10a6 100644 --- a/drivers/net/enetfec/enet_ethdev.c +++ b/drivers/net/enetfec/enet_ethdev.c @@ -454,6 +454,11 @@ enetfec_rx_queue_setup(struct rte_eth_dev *dev, return -EINVAL; } + if (queue_idx >= ENETFEC_MAX_Q) { + ENETFEC_PMD_ERR("Only %u receive queues supported", ENETFEC_MAX_Q); + return -EINVAL; + } + /* allocate receive queue */ rxq = rte_zmalloc(NULL, sizeof(*rxq), RTE_CACHE_LINE_SIZE); if (rxq == NULL) { -- 2.35.1