From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id CB3C4A057B; Wed, 1 Apr 2020 08:38:08 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 37AEB1BE98; Wed, 1 Apr 2020 08:38:08 +0200 (CEST) Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.41]) by dpdk.org (Postfix) with ESMTP id CB86D1BE97 for ; Wed, 1 Apr 2020 08:38:06 +0200 (CEST) Received: by mail-wr1-f41.google.com with SMTP id 65so29156507wrl.1 for ; Tue, 31 Mar 2020 23:38:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netcope.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=/URsMi/JQPYGWN4sGmCzl2ReBl+Cec+cVi4iD7dk5C0=; b=Uejn/RxxiZa3Blnk81vvP25BYuiT2EDFhk+ReXXISMZD3f07xPilCGYUgoefq6n0rV rWDdG3CQXJpFk4dR0pltYbMJdHvbjdCoS1YSiVWP0QvHRwcLYQMCMC+eKSIJXUMTV3dX 8ZA+Jz8Xdp6WTbufCM5wSUSAZviokx9qIwdkNX+7cetTN+bWAGIV8t7fKaPHE9NYwFnf b6AS0gvE1Mdk+jIPNiwZXYdG/Z4gHmBoxNVEPcFbs1Jl/ZqWLYqMgnCOxP+pl1PgR19U 87g2I14o6wZ05Nz4pF0vRX/BquKKYJlT0qSHdFJmv9u/SvvFdLxm9EYojs5rc7t2wYjc nuKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=/URsMi/JQPYGWN4sGmCzl2ReBl+Cec+cVi4iD7dk5C0=; b=jeIjsVq4ixC2dKnInf+kPmBbW9nwZv7UxURsWKnh6GyWMMSgEKPwLqWLNNzWFryijo pNVRIaeEJYu0y1i8AOqZo5UcZgGd8EXoIkICKx8oInZ/uDB3b/x0W4lAe5A8M5ca+R+v SIUCYXQqGjsZYP9GC0od/LqvWk9wIYSaHS0StBJtEXXM2rGz/fdgGK/tW/rNSAcs8tsy MJC7REWwd5poKOG8Bzk5zaP5bKkh6tLb0vifaDgm13K828NXIRf/QxiaEN12iOvdWjiB 7/cAR2fc/9+MQftOIFKE/2Xl7ii0AER4KvvXz5M6s7z9h7aaRYX1ITdDChTWuDdUd5g1 7xdw== X-Gm-Message-State: ANhLgQ1kK7eEtZ6BlysRJGDT2vtjh8IyVGdzvAaQGgc/lFhV5j0aYnTX kib0iFywTHbeIzAMJV7qmtzTONeLxIS4oQ== X-Google-Smtp-Source: ADFU+vvZZNDpGiVMMmCH1oUr0mjhpyEbo3NlFmBPXfgUx3M9YQ9zp+PV0Okm1yFqIivcpHR4uuJnwA== X-Received: by 2002:a5d:4111:: with SMTP id l17mr25943898wrp.271.1585723086135; Tue, 31 Mar 2020 23:38:06 -0700 (PDT) Received: from sw-c1.int.netcope.com ([5.180.196.50]) by smtp.gmail.com with ESMTPSA id t12sm1680660wrm.0.2020.03.31.23.38.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 31 Mar 2020 23:38:05 -0700 (PDT) From: Jakub Neruda To: dev@dpdk.org Cc: Martin Spinler Date: Wed, 1 Apr 2020 08:38:01 +0200 Message-Id: <1585723081-17392-1-git-send-email-neruda@netcope.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1585576438-19715-1-git-send-email-neruda@netcope.com> References: <1585576438-19715-1-git-send-email-neruda@netcope.com> Subject: [dpdk-dev] net/nfb: check rxmac array size X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Martin Spinler The driver wrongly assumed the presence of at least one rxmac in every firmware and accessed to non-existing unit Signed-off-by: Martin Spinler Acked-by: Jakub Neruda diff --git a/drivers/net/nfb/nfb_rxmode.c b/drivers/net/nfb/nfb_rxmode.c index 3327c8272..2d0b613d2 100644 --- a/drivers/net/nfb/nfb_rxmode.c +++ b/drivers/net/nfb/nfb_rxmode.c @@ -54,7 +54,8 @@ nfb_eth_promiscuous_get(struct rte_eth_dev *dev) struct nc_rxmac_status status; status.mac_filter = RXMAC_MAC_FILTER_PROMISCUOUS; - nc_rxmac_read_status(internals->rxmac[0], &status); + if (internals->max_rxmac > 0) + nc_rxmac_read_status(internals->rxmac[0], &status); return (status.mac_filter == RXMAC_MAC_FILTER_PROMISCUOUS); } @@ -102,7 +103,9 @@ nfb_eth_allmulticast_get(struct rte_eth_dev *dev) struct nc_rxmac_status status; status.mac_filter = RXMAC_MAC_FILTER_PROMISCUOUS; - nc_rxmac_read_status(internals->rxmac[0], &status); + + if (internals->max_rxmac > 0) + nc_rxmac_read_status(internals->rxmac[0], &status); return (status.mac_filter == RXMAC_MAC_FILTER_TABLE_BCAST_MCAST); }