Skip to content

Commit 52e597d

Browse files
wvk86davem330
authored andcommitted
net: stmmac: Fix potential integer overflow
The commit d96febe ("net: stmmac: arrange Tx tail pointer update to stmmac_flush_tx_descriptors") introduced the following coverity warning:- 1. Unintentional integer overflow (OVERFLOW_BEFORE_WIDEN) overflow_before_widen: Potentially overflowing expression 'tx_q->cur_tx * desc_size' with type 'unsigned int' (32 bits, unsigned) is evaluated using 32-bit arithmetic, and then used in a context that expects an expression of type dma_addr_t (64 bits, unsigned). Fixed this by assigning tx_tail_addr to dma_addr_t type, as dma_addr_t datatype is decided by CONFIG_ARCH_DMA_ADDR_T_64_BIT. Fixes: d96febe ("net: stmmac: arrange Tx tail pointer update to stmmac_flush_tx_descriptors") Signed-off-by: Wong Vee Khee <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 8ee1a0e commit 52e597d

File tree

1 file changed

+1
-1
lines changed
  • drivers/net/ethernet/stmicro/stmmac

1 file changed

+1
-1
lines changed

drivers/net/ethernet/stmicro/stmmac/stmmac.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ struct stmmac_tx_queue {
7575
unsigned int cur_tx;
7676
unsigned int dirty_tx;
7777
dma_addr_t dma_tx_phy;
78-
u32 tx_tail_addr;
78+
dma_addr_t tx_tail_addr;
7979
u32 mss;
8080
};
8181

0 commit comments

Comments
 (0)