Skip to content

Commit a89cbb1

Browse files
Hao Chendavem330
authored andcommitted
net: hns3: add max order judgement for tx spare buffer
Add max order judgement for tx spare buffer to avoid triggering call trace, print related fail information instead, when user set tx spare buf size to a large value which causes order exceeding 10. Fixes: e445f08 ("net: hns3: add support to set/get tx copybreak buf size via ethtool for hns3 driver") Signed-off-by: Hao Chen <chenhao288@hisilicon.com> Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 8778372 commit a89cbb1

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

drivers/net/ethernet/hisilicon/hns3/hns3_enet.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1038,6 +1038,12 @@ static void hns3_init_tx_spare_buffer(struct hns3_enet_ring *ring)
10381038
return;
10391039

10401040
order = get_order(alloc_size);
1041+
if (order >= MAX_ORDER) {
1042+
if (net_ratelimit())
1043+
dev_warn(ring_to_dev(ring), "failed to allocate tx spare buffer, exceed to max order\n");
1044+
return;
1045+
}
1046+
10411047
tx_spare = devm_kzalloc(ring_to_dev(ring), sizeof(*tx_spare),
10421048
GFP_KERNEL);
10431049
if (!tx_spare) {

0 commit comments

Comments
 (0)