mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH net-next v2] bridge: cfm: fix enum typo in br_cc_ccm_tx_parse
@ 2023-12-20 16:34 Lin Ma
  2023-12-21  8:52 ` Nikolay Aleksandrov
  2023-12-26 22:40 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Lin Ma @ 2023-12-20 16:34 UTC (permalink / raw)
  To: roopa, razor, davem, edumazet, kuba, pabeni, horatiu.vultur,
	henrik.bjoernlund, bridge, netdev, linux-kernel, horms
  Cc: Lin Ma

It appears that there is a typo in the code where the nlattr array is
being parsed with policy br_cfm_cc_ccm_tx_policy, but the instance is
being accessed via IFLA_BRIDGE_CFM_CC_RDI_INSTANCE, which is associated
with the policy br_cfm_cc_rdi_policy.

This problem was introduced by commit 2be665c3940d ("bridge: cfm: Netlink
SET configuration Interface.").

Though it seems like a harmless typo since these two enum owns the exact
same value (1 here), it is quite misleading hence fix it by using the
correct enum IFLA_BRIDGE_CFM_CC_CCM_TX_INSTANCE here.

Signed-off-by: Lin Ma <linma@zju.edu.cn>
Reviewed-by: Simon Horman <horms@kernel.org>
---
V1 -> V2: remove Fixes tag as this patch resolves nothing but a typo.

 net/bridge/br_cfm_netlink.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/bridge/br_cfm_netlink.c b/net/bridge/br_cfm_netlink.c
index 5c4c369f8536..2faab44652e7 100644
--- a/net/bridge/br_cfm_netlink.c
+++ b/net/bridge/br_cfm_netlink.c
@@ -362,7 +362,7 @@ static int br_cc_ccm_tx_parse(struct net_bridge *br, struct nlattr *attr,
 
 	memset(&tx_info, 0, sizeof(tx_info));
 
-	instance = nla_get_u32(tb[IFLA_BRIDGE_CFM_CC_RDI_INSTANCE]);
+	instance = nla_get_u32(tb[IFLA_BRIDGE_CFM_CC_CCM_TX_INSTANCE]);
 	nla_memcpy(&tx_info.dmac.addr,
 		   tb[IFLA_BRIDGE_CFM_CC_CCM_TX_DMAC],
 		   sizeof(tx_info.dmac.addr));
-- 
2.17.1


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

* Re: [PATCH net-next v2] bridge: cfm: fix enum typo in br_cc_ccm_tx_parse
  2023-12-20 16:34 [PATCH net-next v2] bridge: cfm: fix enum typo in br_cc_ccm_tx_parse Lin Ma
@ 2023-12-21  8:52 ` Nikolay Aleksandrov
  2023-12-26 22:40 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Nikolay Aleksandrov @ 2023-12-21  8:52 UTC (permalink / raw)
  To: Lin Ma, roopa, davem, edumazet, kuba, pabeni, horatiu.vultur,
	henrik.bjoernlund, bridge, netdev, linux-kernel, horms

On 20/12/2023 18:34, Lin Ma wrote:
> It appears that there is a typo in the code where the nlattr array is
> being parsed with policy br_cfm_cc_ccm_tx_policy, but the instance is
> being accessed via IFLA_BRIDGE_CFM_CC_RDI_INSTANCE, which is associated
> with the policy br_cfm_cc_rdi_policy.
> 
> This problem was introduced by commit 2be665c3940d ("bridge: cfm: Netlink
> SET configuration Interface.").
> 
> Though it seems like a harmless typo since these two enum owns the exact
> same value (1 here), it is quite misleading hence fix it by using the
> correct enum IFLA_BRIDGE_CFM_CC_CCM_TX_INSTANCE here.
> 
> Signed-off-by: Lin Ma <linma@zju.edu.cn>
> Reviewed-by: Simon Horman <horms@kernel.org>
> ---
> V1 -> V2: remove Fixes tag as this patch resolves nothing but a typo.
> 
>  net/bridge/br_cfm_netlink.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/bridge/br_cfm_netlink.c b/net/bridge/br_cfm_netlink.c
> index 5c4c369f8536..2faab44652e7 100644
> --- a/net/bridge/br_cfm_netlink.c
> +++ b/net/bridge/br_cfm_netlink.c
> @@ -362,7 +362,7 @@ static int br_cc_ccm_tx_parse(struct net_bridge *br, struct nlattr *attr,
>  
>  	memset(&tx_info, 0, sizeof(tx_info));
>  
> -	instance = nla_get_u32(tb[IFLA_BRIDGE_CFM_CC_RDI_INSTANCE]);
> +	instance = nla_get_u32(tb[IFLA_BRIDGE_CFM_CC_CCM_TX_INSTANCE]);
>  	nla_memcpy(&tx_info.dmac.addr,
>  		   tb[IFLA_BRIDGE_CFM_CC_CCM_TX_DMAC],
>  		   sizeof(tx_info.dmac.addr));

Acked-by: Nikolay Aleksandrov <razor@blackwall.org>


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

* Re: [PATCH net-next v2] bridge: cfm: fix enum typo in br_cc_ccm_tx_parse
  2023-12-20 16:34 [PATCH net-next v2] bridge: cfm: fix enum typo in br_cc_ccm_tx_parse Lin Ma
  2023-12-21  8:52 ` Nikolay Aleksandrov
@ 2023-12-26 22:40 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-12-26 22:40 UTC (permalink / raw)
  To: Lin Ma
  Cc: roopa, razor, davem, edumazet, kuba, pabeni, horatiu.vultur,
	henrik.bjoernlund, bridge, netdev, linux-kernel, horms

Hello:

This patch was applied to netdev/net-next.git (main)
by David S. Miller <davem@davemloft.net>:

On Thu, 21 Dec 2023 00:34:51 +0800 you wrote:
> It appears that there is a typo in the code where the nlattr array is
> being parsed with policy br_cfm_cc_ccm_tx_policy, but the instance is
> being accessed via IFLA_BRIDGE_CFM_CC_RDI_INSTANCE, which is associated
> with the policy br_cfm_cc_rdi_policy.
> 
> This problem was introduced by commit 2be665c3940d ("bridge: cfm: Netlink
> SET configuration Interface.").
> 
> [...]

Here is the summary with links:
  - [net-next,v2] bridge: cfm: fix enum typo in br_cc_ccm_tx_parse
    https://git.kernel.org/netdev/net-next/c/c2b2ee36250d

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

end of thread, other threads:[~2023-12-26 22:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-20 16:34 [PATCH net-next v2] bridge: cfm: fix enum typo in br_cc_ccm_tx_parse Lin Ma
2023-12-21  8:52 ` Nikolay Aleksandrov
2023-12-26 22: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

all inboxes | Powered by JetHome®