]> git.baikalelectronics.ru Git - kernel.git/commit
net: hns3: Fix return of uninitialized variable ret
authorColin Ian King <colin.king@canonical.com>
Fri, 21 May 2021 10:01:46 +0000 (11:01 +0100)
committerDavid S. Miller <davem@davemloft.net>
Fri, 21 May 2021 20:56:18 +0000 (13:56 -0700)
commitb35b4301548932ec8f9f6fe1eecd2a3c5cfac728
treee5baa8a45325e4326aeaff152ec6adc3368f606f
parent30be234381dfab76fe34c2fefe7aad690a627b8d
net: hns3: Fix return of uninitialized variable ret

In the unlikely event that rule_cnt is zero the variable ret is
not assigned a value and function hclge_dbg_dump_fd_tcam can end
up returning an unitialized value in ret. Fix this by explicitly
setting ret to zero before the for-loop.

Addresses-Coverity: ("Uninitialized scalar variable")
Fixes: a41e1e1a138a ("net: hns3: refactor dump fd tcam of debugfs")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c