Skip to content

Commit e1f4ebd

Browse files
committed
Merge branch 'xsk-fix-negative-overflow-issues-in-zerocopy-xmit'
Jason Xing says: ==================== xsk: fix negative overflow issues in zerocopy xmit Fix two negative overflow issues around {stmmac_xdp|igb}_xmit_zc(). ==================== Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents eccf7a3 + 3b7c13d commit e1f4ebd

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

drivers/net/ethernet/intel/igb/igb_xsk.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ bool igb_xmit_zc(struct igb_ring *tx_ring, struct xsk_buff_pool *xsk_pool)
482482
if (!nb_pkts)
483483
return true;
484484

485-
while (nb_pkts-- > 0) {
485+
for (; i < nb_pkts; i++) {
486486
dma = xsk_buff_raw_get_dma(xsk_pool, descs[i].addr);
487487
xsk_buff_raw_dma_sync_for_device(xsk_pool, dma, descs[i].len);
488488

@@ -512,7 +512,6 @@ bool igb_xmit_zc(struct igb_ring *tx_ring, struct xsk_buff_pool *xsk_pool)
512512

513513
total_bytes += descs[i].len;
514514

515-
i++;
516515
tx_ring->next_to_use++;
517516
tx_buffer_info->next_to_watch = tx_desc;
518517
if (tx_ring->next_to_use == tx_ring->count)

drivers/net/ethernet/stmicro/stmmac/stmmac_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2596,7 +2596,7 @@ static bool stmmac_xdp_xmit_zc(struct stmmac_priv *priv, u32 queue, u32 budget)
25962596

25972597
budget = min(budget, stmmac_tx_avail(priv, queue));
25982598

2599-
while (budget-- > 0) {
2599+
for (; budget > 0; budget--) {
26002600
struct stmmac_metadata_request meta_req;
26012601
struct xsk_tx_metadata *meta = NULL;
26022602
dma_addr_t dma_addr;

0 commit comments

Comments
 (0)