Skip to content

Commit e327b23

Browse files
nikita-youshdavem330
authored andcommitted
net: ravb: Fix dma_addr_t truncation in error case
In ravb_start_xmit(), ravb driver uses u32 variable to store result of dma_map_single() call. Since ravb hardware has 32-bit address fields in descriptors, this works properly when mapping is successful - it is platform's job to provide mapping addresses that fit into hardware limitations. However, in failure case dma_map_single() returns DMA_MAPPING_ERROR constant that is 64-bit when dma_addr_t is 64-bit. Storing this constant in u32 leads to truncation, and further call to dma_mapping_error() fails to notice the error. Fix that by storing result of dma_map_single() in a dma_addr_t variable. Fixes: c156633 ("Renesas Ethernet AVB driver proper") Signed-off-by: Nikita Yushchenko <nikita.yoush@cogentembedded.com> Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru> Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent c061be1 commit e327b23

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/net/ethernet/renesas/ravb_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1949,7 +1949,7 @@ static netdev_tx_t ravb_start_xmit(struct sk_buff *skb, struct net_device *ndev)
19491949
struct ravb_tstamp_skb *ts_skb;
19501950
struct ravb_tx_desc *desc;
19511951
unsigned long flags;
1952-
u32 dma_addr;
1952+
dma_addr_t dma_addr;
19531953
void *buffer;
19541954
u32 entry;
19551955
u32 len;

0 commit comments

Comments
 (0)