net: microchip: sparx5: prevent uninitialized variable
authorDan Carpenter <error27@gmail.com>
Thu, 17 Nov 2022 15:29:05 +0000 (18:29 +0300)
committerDavid S. Miller <davem@davemloft.net>
Mon, 21 Nov 2022 10:06:47 +0000 (10:06 +0000)
commit62a45b384a2833fbdff4658a56dab38e9d6f4580
tree4fb8a6dcb2cda13ede817140dfd187e08196138d
parentef8c373bd91df3cf70596497da0955d218961ead
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.

Fixes: 23f8382cd95d ("net: microchip: sparx5: add support for apptrust")
Signed-off-by: Dan Carpenter <error27@gmail.com>
Reviewed-by: Daniel Machon <daniel.machon@microchip.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/microchip/sparx5/sparx5_dcb.c