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 30690A057B; Mon, 30 Mar 2020 18:03:01 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6B0231BFDC; Mon, 30 Mar 2020 18:03:00 +0200 (CEST) Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) by dpdk.org (Postfix) with ESMTP id CF5482B8B for ; Mon, 30 Mar 2020 15:54:28 +0200 (CEST) Received: by mail-wm1-f47.google.com with SMTP id 26so16020725wmk.1 for ; Mon, 30 Mar 2020 06:54:28 -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; bh=CUzuzoaKkXayBn6/8FGh0Yi8djZBsR4KKvB6JcJmjyg=; b=RpakqstcxZjJeyidBnqPR57iahvGU7MWvhljZoBAXZgRg6vaytoHtnPv4jqQP+2CIa pyNJsWyAcSvVL1xWSXzKMYgcNc3BOPO9ENifrmC4SDgTLo4vHBQYNy3ZoSy4253jqydi kXdmmGI4PX08vjy6BEOQhCFhj0HfwVehdB6HzqvtmoZfkLOm0DK/C29DJRSxD5SDGAQp 49yyetXQ1VijrHeeBfSpLJu0cZE5i0fooADes23jeaq908gOLzPNgukSLLCPmEW+XY8U ffFnUNEXIGkHNd+31PzwpIs+K9+BRKIwE3O91Rdmiu/6rQ5xytrDmr5gGrLPyaYVgvZY QrPg== 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; bh=CUzuzoaKkXayBn6/8FGh0Yi8djZBsR4KKvB6JcJmjyg=; b=ItPoB5sNldysHqUf08F1fb2liCJtn7XdCpSsH2XSEbXV/E27s2o5ZxGBKxs2itK4AQ 2fmjXCXvwCXl27TD7L8qJtFMJCaLRfuwWRheLZjYQZ5sVq3Io7g15y9cpR9MJLq8O1Yl deu5Ixg9WPPga23kl0PxNQ9yN+Uxtwnw7eD3+KjPJRYSSi16sFUmoZIwH1XJue+Fi/EP Hkb9mguL2w/cF10bK4Aorc0sUfWkhthrYF0DUzBwOTAazwcIjuF1XWXvnH/9DzgzlTn8 7hZaz9KHa4mp5uYqtzomxi2plCCul4i3luXiIs39G2/JQ0P2+NcEAlLcv/5nzFfIX9lA 9yLg== X-Gm-Message-State: ANhLgQ3gAGETZTjCX0hlA6IKZtWRClxN5EP5yzwObBv/RQsKJusjDcVr Y53z4CdV2gQaWubggYdftpjo1b5eGlJcsg== X-Google-Smtp-Source: ADFU+vuF7xxQg2IhhidflyFVj5qZOQoGfHQJMXLmWImeH+qXW67Wjy25mevdN7R+qVGRYxLzg0BjGg== X-Received: by 2002:a1c:ba06:: with SMTP id k6mr12631048wmf.136.1585576467309; Mon, 30 Mar 2020 06:54:27 -0700 (PDT) Received: from sw-c1.int.netcope.com ([5.180.196.50]) by smtp.gmail.com with ESMTPSA id y11sm12904025wmi.13.2020.03.30.06.54.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 Mar 2020 06:54:26 -0700 (PDT) From: Jakub Neruda To: dev@dpdk.org Cc: Martin Spinler Date: Mon, 30 Mar 2020 15:53:58 +0200 Message-Id: <1585576438-19715-1-git-send-email-neruda@netcope.com> X-Mailer: git-send-email 1.8.3.1 X-Mailman-Approved-At: Mon, 30 Mar 2020 18:02:59 +0200 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); }