diff mbox series

[v1] bridge: cfm: fix enum typo in br_cc_ccm_tx_parse

Message ID 20231220075914.2426376-1-linma@zju.edu.cn (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series [v1] bridge: cfm: fix enum typo in br_cc_ccm_tx_parse | expand

Checks

Context Check Description
netdev/series_format warning Single patches do not need cover letters; Target tree name not specified in the subject
netdev/tree_selection success Guessed tree name to be net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 1115 this patch: 1115
netdev/cc_maintainers success CCed 9 of 9 maintainers
netdev/build_clang fail Errors and warnings before: 12 this patch: 12
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 1142 this patch: 1142
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Lin Ma Dec. 20, 2023, 7:59 a.m. UTC
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.

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.

Fixes: 2be665c3940d ("bridge: cfm: Netlink SET configuration Interface.")
Signed-off-by: Lin Ma <linma@zju.edu.cn>
---
 net/bridge/br_cfm_netlink.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Simon Horman Dec. 20, 2023, 4:17 p.m. UTC | #1
On Wed, Dec 20, 2023 at 03:59:14PM +0800, 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.
> 
> 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.
> 
> Fixes: 2be665c3940d ("bridge: cfm: Netlink SET configuration Interface.")
> Signed-off-by: Lin Ma <linma@zju.edu.cn>

Thanks Lin Ma,

I agree with your analysis, that the problem was introduced in the
cited commit, and that it is resolved by your patch.

However, as there is no user-visible bug I don't believe this reaches
the bar for a 'fix' for Networking code. Accordingly, I think that
the Fixes tag should be dropped. And, instead cited commit can be mentioned
using something like "This problem was introduced by commit ...".

Also, as I don't think it is a fix I think it should be targeted at the
net-next tree:

	Subject: [PATCH net-next vX] ...

The above nits notwithstanding,

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

> ---
>  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
> 
>
Lin Ma Dec. 20, 2023, 4:29 p.m. UTC | #2
Hello Simon,

> 
> Thanks Lin Ma,
> 
> I agree with your analysis, that the problem was introduced in the
> cited commit, and that it is resolved by your patch.
> 

Thanks for the encouragement.

> However, as there is no user-visible bug I don't believe this reaches
> the bar for a 'fix' for Networking code. Accordingly, I think that
> the Fixes tag should be dropped. And, instead cited commit can be mentioned
> using something like "This problem was introduced by commit ...".
> 
> Also, as I don't think it is a fix I think it should be targeted at the
> net-next tree:
> 
> 	Subject: [PATCH net-next vX] ...
> 

Copy that. Yeah, once the enum IFLA_BRIDGE_CFM_CC_RDI_INSTANCE and the
IFLA_BRIDGE_CFM_CC_CCM_TX_INSTANCE keeps the value 1, everything should work
as usual. I will resend the patch as told.

> The above nits notwithstanding,
> 
> Reviewed-by: Simon Horman <horms@kernel.org>
> 

Regards
Lin
Simon Horman Dec. 20, 2023, 4:53 p.m. UTC | #3
On Thu, Dec 21, 2023 at 12:29:16AM +0800, Lin Ma wrote:
> Hello Simon,
> 
> > 
> > Thanks Lin Ma,
> > 
> > I agree with your analysis, that the problem was introduced in the
> > cited commit, and that it is resolved by your patch.
> > 
> 
> Thanks for the encouragement.
> 
> > However, as there is no user-visible bug I don't believe this reaches
> > the bar for a 'fix' for Networking code. Accordingly, I think that
> > the Fixes tag should be dropped. And, instead cited commit can be mentioned
> > using something like "This problem was introduced by commit ...".
> > 
> > Also, as I don't think it is a fix I think it should be targeted at the
> > net-next tree:
> > 
> > 	Subject: [PATCH net-next vX] ...
> > 
> 
> Copy that. Yeah, once the enum IFLA_BRIDGE_CFM_CC_RDI_INSTANCE and the
> IFLA_BRIDGE_CFM_CC_CCM_TX_INSTANCE keeps the value 1, everything should work
> as usual. I will resend the patch as told.

Thanks, much appreciated.
v2 looks good to me.

> 
> > The above nits notwithstanding,
> > 
> > Reviewed-by: Simon Horman <horms@kernel.org>
> > 
> 
> Regards
> Lin
diff mbox series

Patch

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