Skip to content

Commit

Permalink
net: hns3: fix for vport->bw_limit overflow problem
Browse files Browse the repository at this point in the history
When setting vport->bw_limit to hdev->tm_info.pg_info[0].bw_limit
in hclge_tm_vport_tc_info_update, vport->bw_limit can be as big as
HCLGE_ETHER_MAX_RATE (100000), which can not fit into u16 (65535).

So this patch fixes it by using u32 for vport->bw_limit.

Fixes: 8484405 ("net: hns3: Add support of TX Scheduler & Shaper to HNS3 driver")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com>
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Yunsheng Lin authored and David S. Miller committed Apr 15, 2019
1 parent 8a9a654 commit 2566f10
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h
Original file line number Diff line number Diff line change
Expand Up @@ -854,7 +854,7 @@ struct hclge_vport {
u16 alloc_rss_size;

u16 qs_offset;
u16 bw_limit; /* VSI BW Limit (0 = disabled) */
u32 bw_limit; /* VSI BW Limit (0 = disabled) */
u8 dwrr;

struct hclge_port_base_vlan_config port_base_vlan_cfg;
Expand Down

0 comments on commit 2566f10

Please sign in to comment.