public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: xuanzhuo@linux.alibaba.com
Cc: Jakub Kicinski <kuba@kernel.org>,
	edumazet@google.com, lulie@linux.alibaba.com, andrew@lunn.ch,
	dust.li@linux.alibaba.com, andrew+netdev@lunn.ch,
	guwen@linux.alibaba.com, lorenzo@kernel.org,
	lukas.bulwahn@redhat.com, davem@davemloft.net, dong100@mucse.com,
	vadim.fedorenko@linux.dev, pabeni@redhat.com,
	netdev@vger.kernel.org, hkallweit1@gmail.com
Subject: Re: [net-next,v23,5/6] eea: introduce ethtool support
Date: Thu, 29 Jan 2026 20:02:15 -0800	[thread overview]
Message-ID: <20260130040215.708811-1-kuba@kernel.org> (raw)
In-Reply-To: <20260128055232.8021-6-xuanzhuo@linux.alibaba.com>

This is an AI-generated review of your patch. The human sending this
email has considered the AI review valid, or at least plausible.

For local reproduction steps see https://netdev-ai.bots.linux.dev/ai-local.html
---
eea: introduce ethtool support

This commit adds ethtool support for the Alibaba Elastic Ethernet Adapter
(EEA) driver, including statistics retrieval, ring parameter configuration,
and channel management.

> diff --git a/drivers/net/ethernet/alibaba/eea/eea_ethtool.c b/drivers/net/ethernet/alibaba/eea/eea_ethtool.c
> new file mode 100644
> index 000000000000..b903ae368473
> --- /dev/null
> +++ b/drivers/net/ethernet/alibaba/eea/eea_ethtool.c

[ ... ]

> +static void eea_get_ethtool_stats(struct net_device *netdev,
> +				  struct ethtool_stats *stats, u64 *data)
> +{
> +	struct eea_net *enet = netdev_priv(netdev);
> +	u32 i, idx = 0;
> +
> +	for (i = 0; i < enet->cfg.rx_ring_num; i++) {
> +		struct eea_net_rx *rx = enet->rx[i];

Can this dereference of enet->rx[i] cause a NULL pointer crash when the
device is not running?

Looking at the driver lifecycle, enet->rx is NULL after probe (before the
device is opened) and after close. However, enet->cfg.rx_ring_num is set
to a non-zero value during probe via eea_update_cfg(). This means if a
user runs "ethtool -S ethX" on a device that has not been brought up,
the loop will execute with enet->rx being NULL.

The follow-up commit 3b731fea0a60 ("eea: introduce callback for
ndo_get_stats64") adds an "if (enet->rx)" check before a similar loop in
eea_stats(), suggesting awareness of this issue. Should a similar check
be added here?

> +
> +		eea_stats_fill_for_q(&rx->stats.syncp, EEA_RX_STATS_LEN,
> +				     eea_rx_stats_desc, data, idx);
> +
> +		idx += EEA_RX_STATS_LEN;
> +	}
> +
> +	for (i = 0; i < enet->cfg.tx_ring_num; i++) {
> +		struct eea_net_tx *tx = &enet->tx[i];

The same question applies here for enet->tx.

> +
> +		eea_stats_fill_for_q(&tx->stats.syncp, EEA_TX_STATS_LEN,
> +				     eea_tx_stats_desc, data, idx);
> +
> +		idx += EEA_TX_STATS_LEN;
> +	}
> +}

[ ... ]

  reply	other threads:[~2026-01-30  4:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-28  5:52 [PATCH net-next v23 0/6] eea: Add basic driver framework for Alibaba Elastic Ethernet Adaptor Xuan Zhuo
2026-01-28  5:52 ` [PATCH net-next v23 1/6] eea: introduce PCI framework Xuan Zhuo
2026-01-28  5:52 ` [PATCH net-next v23 2/6] eea: introduce ring and descriptor structures Xuan Zhuo
2026-01-28  5:52 ` [PATCH net-next v23 3/6] eea: probe the netdevice and create adminq Xuan Zhuo
2026-01-28  5:52 ` [PATCH net-next v23 4/6] eea: create/destroy rx,tx queues for netdevice open and stop Xuan Zhuo
2026-01-30  4:02   ` [net-next,v23,4/6] " Jakub Kicinski
2026-01-28  5:52 ` [PATCH net-next v23 5/6] eea: introduce ethtool support Xuan Zhuo
2026-01-30  4:02   ` Jakub Kicinski [this message]
2026-01-28  5:52 ` [PATCH net-next v23 6/6] eea: introduce callback for ndo_get_stats64 Xuan Zhuo

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=20260130040215.708811-1-kuba@kernel.org \
    --to=kuba@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=dong100@mucse.com \
    --cc=dust.li@linux.alibaba.com \
    --cc=edumazet@google.com \
    --cc=guwen@linux.alibaba.com \
    --cc=hkallweit1@gmail.com \
    --cc=lorenzo@kernel.org \
    --cc=lukas.bulwahn@redhat.com \
    --cc=lulie@linux.alibaba.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=vadim.fedorenko@linux.dev \
    --cc=xuanzhuo@linux.alibaba.com \
    /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