netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Lorenzo Bianconi <lorenzo@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:29:29 +0200	[thread overview]
Message-ID: <20230913112929.GS401982@kernel.org> (raw)
In-Reply-To: <b0d233386e059bccb59f18f69afb79a7806e5ded.1694507226.git.lorenzo@kernel.org>

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,

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?

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
> 
> 

  reply	other threads:[~2023-09-13 11:29 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 [this message]
2023-09-13 11:47   ` Lorenzo Bianconi
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=20230913112929.GS401982@kernel.org \
    --to=horms@kernel.org \
    --cc=Mark-MC.Lee@mediatek.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=john@phrozen.org \
    --cc=kuba@kernel.org \
    --cc=lorenzo.bianconi@redhat.com \
    --cc=lorenzo@kernel.org \
    --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 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).