net: microchip: sparx5: prevent uninitialized variable
PATCH v2 1/1 net: microchip: sparx5: prevent uninitialized variable
Smatch complains that:
drivers/net/ethernet/microchip/sparx5/sparx5_dcb.c:112 sparx5_dcb_apptrust_validate() error: uninitialized symbol 'match'.
This would only happen if the:
if (sparx5_dcb_apptrust_policies[i].nselectors != nselectors)
condition is always true (they are not equal). The "nselectors" variable comes from dcbnl_ieee_set() and it is a number between 0-256. This seems like a probably a real bug.
---
v2: Update my email address. Also add Daniel's R-b tag.
drivers/net/ethernet/microchip/sparx5/sparx5_dcb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/microchip/sparx5/sparx5_dcb.c +1 -1
@@ -90,7 +90,7 @@ static int sparx5_dcb_app_validate(struct net_device *dev,static int sparx5_dcb_apptrust_validate (struct net_device *dev,u8 *selectors,int nselectors,int *err) { -bool match; +bool match = false;int i, ii;for (i =0 ; i <ARRAY_SIZE (sparx5_dcb_apptrust_policies); i++) {
Signature · 1 line
2.35.1
This patch was applied to netdev/net-next.git (master) by David S. Miller <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (master) by David S. Miller <[email protected]>:
Quoted 8 lines · On Thu, 17 Nov 2022 18:29:05 +0300 you wrote:
Smatch complains that:
drivers/net/ethernet/microchip/sparx5/sparx5_dcb.c:112sparx5_dcb_apptrust_validate()error: uninitialized symbol 'match'.This would only happen if the:
[...]
Here is the summary with links:
- [net-next,v2] net: microchip: sparx5: prevent uninitialized variable
https://git.kernel.org/netdev/net-next/c/62a45b384a28
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html