All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lorenzo Bianconi <lorenzo@kernel.org>
To: Simon Horman <horms@kernel.org>
Cc: netdev@vger.kernel.org, lorenzo.bianconi@redhat.com,
	nbd@nbd.name, john@phrozen.org, sean.wang@mediatek.com,
	Mark-MC.Lee@mediatek.com, davem@davemloft.net,
	edumazet@google.com, kuba@kernel.org, pabeni@redhat.com
Subject: Re: [PATCH net-next] net: ethernet: mtk_wed: check update_wo_rx_stats in mtk_wed_update_rx_stats()
Date: Wed, 13 Sep 2023 13:47:49 +0200	[thread overview]
Message-ID: <ZQGhZcA1e7CjnL+P@lore-desk> (raw)
In-Reply-To: <20230913112929.GS401982@kernel.org>

[-- Attachment #1: Type: text/plain, Size: 1566 bytes --]

> On Tue, Sep 12, 2023 at 10:28:00AM +0200, Lorenzo Bianconi wrote:
> > Check if update_wo_rx_stats function pointer is properly set in
> > mtk_wed_update_rx_stats routine before accessing it.
> > 
> > Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
> 
> Hi Lorenzo,

Hi Simon,

> 
> I'm a little curious about this.
> 
> Is there a condition where it is not set but accessed,
> which would presumably be a bug that warrants a fixes tag and
> targeting at 'net'?
> 
> Or can it not occur, in which case this check is perhaps not needed?

nope, so far Wireless Ethernet Dispatches (WED) is supported just by mt7915
that sets update_wo_rx_stats callback. Howerver, I am currently working on WED
support for mt7996 where we do not have this callback available at the moment.

Regards,
Lorenzo

> 
> Or something else?
> 
> > ---
> >  drivers/net/ethernet/mediatek/mtk_wed_mcu.c | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/drivers/net/ethernet/mediatek/mtk_wed_mcu.c b/drivers/net/ethernet/mediatek/mtk_wed_mcu.c
> > index 071ed3dea860..72bcdaed12a9 100644
> > --- a/drivers/net/ethernet/mediatek/mtk_wed_mcu.c
> > +++ b/drivers/net/ethernet/mediatek/mtk_wed_mcu.c
> > @@ -68,6 +68,9 @@ mtk_wed_update_rx_stats(struct mtk_wed_device *wed, struct sk_buff *skb)
> >  	struct mtk_wed_wo_rx_stats *stats;
> >  	int i;
> >  
> > +	if (!wed->wlan.update_wo_rx_stats)
> > +		return;
> > +
> >  	if (count * sizeof(*stats) > skb->len - sizeof(u32))
> >  		return;
> >  
> > -- 
> > 2.41.0
> > 
> > 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  reply	other threads:[~2023-09-13 11:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-12  8:28 [PATCH net-next] net: ethernet: mtk_wed: check update_wo_rx_stats in mtk_wed_update_rx_stats() Lorenzo Bianconi
2023-09-13 11:29 ` Simon Horman
2023-09-13 11:47   ` Lorenzo Bianconi [this message]
2023-09-13 13:53     ` Simon Horman
2023-09-14 13:40 ` patchwork-bot+netdevbpf

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=ZQGhZcA1e7CjnL+P@lore-desk \
    --to=lorenzo@kernel.org \
    --cc=Mark-MC.Lee@mediatek.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=john@phrozen.org \
    --cc=kuba@kernel.org \
    --cc=lorenzo.bianconi@redhat.com \
    --cc=nbd@nbd.name \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sean.wang@mediatek.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.