mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-24 11:25:43 +00:00
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: b5a0b70d77
("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>
This commit is contained in:
parent
04fdfad68b
commit
030c8198d7
1 changed files with 1 additions and 0 deletions
|
@ -1519,6 +1519,7 @@ static int hclge_dbg_dump_fd_tcam(struct hclge_dev *hdev, char *buf, int len)
|
|||
goto out;
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
for (i = 0; i < rule_cnt; i++) {
|
||||
tcam_msg.stage = HCLGE_FD_STAGE_1;
|
||||
tcam_msg.loc = rule_locs[i];
|
||||
|
|
Loading…
Reference in a new issue