提交 62a45b38 编写于 作者: D Dan Carpenter 提交者: David S. Miller

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: 23f8382c ("net: microchip: sparx5: add support for apptrust")
Signed-off-by: NDan Carpenter <error27@gmail.com>
Reviewed-by: NDaniel Machon <daniel.machon@microchip.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 ef8c373b
......@@ -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++) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册