All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] net: dsa: sja1105: fix error return code in sja1105_cls_flower_add()
@ 2021-03-15 14:43 'w00385741
  2021-03-15 20:14 ` Vladimir Oltean
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: 'w00385741 @ 2021-03-15 14:43 UTC (permalink / raw)
  To: weiyongjun1, Vladimir Oltean, Andrew Lunn, Vivien Didelot,
	Florian Fainelli, Jakub Kicinski, Baowen Zheng
  Cc: netdev, kernel-janitors, Hulk Robot

From: Wei Yongjun <weiyongjun1@huawei.com>

The return value 'rc' maybe overwrite to 0 in the flow_action_for_each
loop, the error code from the offload not support error handling will
not set. This commit fix it to return -EOPNOTSUPP.

Fixes: 6a56e19902af ("flow_offload: reject configuration of packet-per-second policing in offload drivers")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 drivers/net/dsa/sja1105/sja1105_flower.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/dsa/sja1105/sja1105_flower.c b/drivers/net/dsa/sja1105/sja1105_flower.c
index f78b767f86ee..973761132fc3 100644
--- a/drivers/net/dsa/sja1105/sja1105_flower.c
+++ b/drivers/net/dsa/sja1105/sja1105_flower.c
@@ -317,14 +317,13 @@ int sja1105_cls_flower_add(struct dsa_switch *ds, int port,
 	if (rc)
 		return rc;
 
-	rc = -EOPNOTSUPP;
-
 	flow_action_for_each(i, act, &rule->action) {
 		switch (act->id) {
 		case FLOW_ACTION_POLICE:
 			if (act->police.rate_pkt_ps) {
 				NL_SET_ERR_MSG_MOD(extack,
 						   "QoS offload not support packets per second");
+				rc = -EOPNOTSUPP;
 				goto out;
 			}
 


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

* Re: [PATCH net-next] net: dsa: sja1105: fix error return code in sja1105_cls_flower_add()
  2021-03-15 14:43 [PATCH net-next] net: dsa: sja1105: fix error return code in sja1105_cls_flower_add() 'w00385741
@ 2021-03-15 20:14 ` Vladimir Oltean
  2021-03-16  9:10 ` Dan Carpenter
  2021-03-16 18:20 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Vladimir Oltean @ 2021-03-15 20:14 UTC (permalink / raw)
  To: 'w00385741
  Cc: Andrew Lunn, Vivien Didelot, Florian Fainelli, Jakub Kicinski,
	Baowen Zheng, netdev, kernel-janitors, Hulk Robot

On Mon, Mar 15, 2021 at 02:43:23PM +0000, 'w00385741 wrote:
> From: Wei Yongjun <weiyongjun1@huawei.com>
> 
> The return value 'rc' maybe overwrite to 0 in the flow_action_for_each
> loop, the error code from the offload not support error handling will
> not set. This commit fix it to return -EOPNOTSUPP.
> 
> Fixes: 6a56e19902af ("flow_offload: reject configuration of packet-per-second policing in offload drivers")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> ---

Thank you for the patch, Yongjun.

Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>

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

* Re: [PATCH net-next] net: dsa: sja1105: fix error return code in sja1105_cls_flower_add()
  2021-03-15 14:43 [PATCH net-next] net: dsa: sja1105: fix error return code in sja1105_cls_flower_add() 'w00385741
  2021-03-15 20:14 ` Vladimir Oltean
@ 2021-03-16  9:10 ` Dan Carpenter
  2021-03-16 18:20 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2021-03-16  9:10 UTC (permalink / raw)
  To: 'w00385741
  Cc: Vladimir Oltean, Andrew Lunn, Vivien Didelot, Florian Fainelli,
	Jakub Kicinski, Baowen Zheng, netdev, kernel-janitors,
	Hulk Robot

On Mon, Mar 15, 2021 at 02:43:23PM +0000, 'w00385741 wrote:
> From: Wei Yongjun <weiyongjun1@huawei.com>
> 
> The return value 'rc' maybe overwrite to 0 in the flow_action_for_each
> loop, the error code from the offload not support error handling will
> not set. This commit fix it to return -EOPNOTSUPP.
> 
> Fixes: 6a56e19902af ("flow_offload: reject configuration of packet-per-second policing in offload drivers")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> ---
>  drivers/net/dsa/sja1105/sja1105_flower.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/net/dsa/sja1105/sja1105_flower.c b/drivers/net/dsa/sja1105/sja1105_flower.c
> index f78b767f86ee..973761132fc3 100644
> --- a/drivers/net/dsa/sja1105/sja1105_flower.c
> +++ b/drivers/net/dsa/sja1105/sja1105_flower.c
> @@ -317,14 +317,13 @@ int sja1105_cls_flower_add(struct dsa_switch *ds, int port,
>  	if (rc)
>  		return rc;
>  
> -	rc = -EOPNOTSUPP;
> -
>  	flow_action_for_each(i, act, &rule->action) {
>  		switch (act->id) {
>  		case FLOW_ACTION_POLICE:
>  			if (act->police.rate_pkt_ps) {
>  				NL_SET_ERR_MSG_MOD(extack,
>  						   "QoS offload not support packets per second");
> +				rc = -EOPNOTSUPP;
>  				goto out;

Yep.  The goto out is a do nothing goto and "forgot the error code" is
the traditional bug introduced by do nothing gotos.

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>

regards,
dan carpenter


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

* Re: [PATCH net-next] net: dsa: sja1105: fix error return code in sja1105_cls_flower_add()
  2021-03-15 14:43 [PATCH net-next] net: dsa: sja1105: fix error return code in sja1105_cls_flower_add() 'w00385741
  2021-03-15 20:14 ` Vladimir Oltean
  2021-03-16  9:10 ` Dan Carpenter
@ 2021-03-16 18:20 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-03-16 18:20 UTC (permalink / raw)
  To: 'w00385741
  Cc: olteanv, andrew, vivien.didelot, f.fainelli, kuba, baowen.zheng,
	netdev, kernel-janitors, hulkci

Hello:

This patch was applied to netdev/net-next.git (refs/heads/master):

On Mon, 15 Mar 2021 14:43:23 +0000 you wrote:
> From: Wei Yongjun <weiyongjun1@huawei.com>
> 
> The return value 'rc' maybe overwrite to 0 in the flow_action_for_each
> loop, the error code from the offload not support error handling will
> not set. This commit fix it to return -EOPNOTSUPP.
> 
> Fixes: 6a56e19902af ("flow_offload: reject configuration of packet-per-second policing in offload drivers")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> 
> [...]

Here is the summary with links:
  - [net-next] net: dsa: sja1105: fix error return code in sja1105_cls_flower_add()
    https://git.kernel.org/netdev/net-next/c/6f0d32509a92

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] 4+ messages in thread

end of thread, other threads:[~2021-03-16 18:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-15 14:43 [PATCH net-next] net: dsa: sja1105: fix error return code in sja1105_cls_flower_add() 'w00385741
2021-03-15 20:14 ` Vladimir Oltean
2021-03-16  9:10 ` Dan Carpenter
2021-03-16 18:20 ` patchwork-bot+netdevbpf

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.