DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jakub Neruda <neruda@netcope.com>
To: dev@dpdk.org
Cc: Martin Spinler <spinler@cesnet.cz>
Subject: [dpdk-dev] net/nfb: check rxmac array size
Date: Wed,  1 Apr 2020 08:38:01 +0200	[thread overview]
Message-ID: <1585723081-17392-1-git-send-email-neruda@netcope.com> (raw)
In-Reply-To: <1585576438-19715-1-git-send-email-neruda@netcope.com>

From: Martin Spinler <spinler@cesnet.cz>

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 <spinler@cesnet.cz>
Acked-by: Jakub Neruda <neruda@netcope.com>

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);
 }


  reply	other threads:[~2020-04-01  6:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-30 13:53 Jakub Neruda
2020-04-01  6:38 ` Jakub Neruda [this message]
2020-04-01 17:48   ` Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1585723081-17392-1-git-send-email-neruda@netcope.com \
    --to=neruda@netcope.com \
    --cc=dev@dpdk.org \
    --cc=spinler@cesnet.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).