Skip to content

Commit

Permalink
net/hns3: fix variable type mismatch
Browse files Browse the repository at this point in the history
[ upstream commit 1bbac8785cdf51bc6c5005c6754eab4d517cc4b0 ]

Loop conditions are compared with different variable types,
which may cause overflow risks.

Fixes: 67d0103 ("net/hns3: adjust data type of some variables")
Fixes: 6ee07e3 ("net/hns3: fix insecure way to query MAC statistics")

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
  • Loading branch information
Dengdui Huang authored and kevintraynor committed Jul 11, 2023
1 parent 4077943 commit 5c10505
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions drivers/net/hns3/hns3_regs.c
Original file line number Diff line number Diff line change
Expand Up @@ -294,8 +294,9 @@ hns3_direct_access_regs(struct hns3_hw *hw, uint32_t *data)
struct hns3_adapter *hns = HNS3_DEV_HW_TO_ADAPTER(hw);
uint32_t *origin_data_ptr = data;
uint32_t reg_offset;
int reg_num;
int i, j;
size_t reg_num;
uint16_t j;
size_t i;

/* fetching per-PF registers values from PF PCIe register space */
reg_num = sizeof(cmdq_reg_addrs) / sizeof(uint32_t);
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/hns3/hns3_stats.c
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ hns3_update_mac_stats(struct hns3_hw *hw)
uint32_t stats_iterms;
uint64_t *desc_data;
uint32_t desc_num;
uint16_t i;
uint32_t i;
int ret;

/* The first desc has a 64-bit header, so need to consider it. */
Expand Down

0 comments on commit 5c10505

Please sign in to comment.