netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: ethernet: mtk_wed: check update_wo_rx_stats in mtk_wed_update_rx_stats()
@ 2023-09-12  8:28 Lorenzo Bianconi
  2023-09-13 11:29 ` Simon Horman
  2023-09-14 13:40 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 5+ messages in thread
From: Lorenzo Bianconi @ 2023-09-12  8:28 UTC (permalink / raw)
  To: netdev
  Cc: lorenzo.bianconi, nbd, john, sean.wang, Mark-MC.Lee, davem,
	edumazet, kuba, pabeni

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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next] net: ethernet: mtk_wed: check update_wo_rx_stats in mtk_wed_update_rx_stats()
  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
  2023-09-14 13:40 ` patchwork-bot+netdevbpf
  1 sibling, 1 reply; 5+ messages in thread
From: Simon Horman @ 2023-09-13 11:29 UTC (permalink / raw)
  To: Lorenzo Bianconi
  Cc: netdev, lorenzo.bianconi, nbd, john, sean.wang, Mark-MC.Lee,
	davem, edumazet, kuba, pabeni

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next] net: ethernet: mtk_wed: check update_wo_rx_stats in mtk_wed_update_rx_stats()
  2023-09-13 11:29 ` Simon Horman
@ 2023-09-13 11:47   ` Lorenzo Bianconi
  2023-09-13 13:53     ` Simon Horman
  0 siblings, 1 reply; 5+ messages in thread
From: Lorenzo Bianconi @ 2023-09-13 11:47 UTC (permalink / raw)
  To: Simon Horman
  Cc: netdev, lorenzo.bianconi, nbd, john, sean.wang, Mark-MC.Lee,
	davem, edumazet, kuba, pabeni

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next] net: ethernet: mtk_wed: check update_wo_rx_stats in mtk_wed_update_rx_stats()
  2023-09-13 11:47   ` Lorenzo Bianconi
@ 2023-09-13 13:53     ` Simon Horman
  0 siblings, 0 replies; 5+ messages in thread
From: Simon Horman @ 2023-09-13 13:53 UTC (permalink / raw)
  To: Lorenzo Bianconi
  Cc: netdev, lorenzo.bianconi, nbd, john, sean.wang, Mark-MC.Lee,
	davem, edumazet, kuba, pabeni

On Wed, Sep 13, 2023 at 01:47:49PM +0200, Lorenzo Bianconi wrote:
> > 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.

Thanks Lorenzo,

Understood. In that case the patch looks good to me.

Reviewed-by: Simon Horman <horms@kernel.org>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next] net: ethernet: mtk_wed: check update_wo_rx_stats in mtk_wed_update_rx_stats()
  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-14 13:40 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-09-14 13:40 UTC (permalink / raw)
  To: Lorenzo Bianconi
  Cc: netdev, lorenzo.bianconi, nbd, john, sean.wang, Mark-MC.Lee,
	davem, edumazet, kuba, pabeni

Hello:

This patch was applied to netdev/net-next.git (main)
by Paolo Abeni <pabeni@redhat.com>:

On Tue, 12 Sep 2023 10:28:00 +0200 you 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>
> ---
>  drivers/net/ethernet/mediatek/mtk_wed_mcu.c | 3 +++
>  1 file changed, 3 insertions(+)

Here is the summary with links:
  - [net-next] net: ethernet: mtk_wed: check update_wo_rx_stats in mtk_wed_update_rx_stats()
    https://git.kernel.org/netdev/net-next/c/486e6ca6b48d

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-09-14 13:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2023-09-13 13:53     ` Simon Horman
2023-09-14 13:40 ` patchwork-bot+netdevbpf

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