Skip to contentSkip to conversation

bnxt_en: Fix zero padding of tx push data.

PATCH Applied Michael Chan 2 participants 2 messages Feb 22, 2016 – Feb 24, 2016

Subsystems (3)
lore
Share & tools
lore

Michael Chan

author maintainer
#0 lore raw

PATCH 1/1 bnxt_en: Fix zero padding of tx push data.

The arithmetic to zero pad the last 64-bit word in the push buffer is not correct.

1. It should be pdata + length to get to the end.
2. 'pdata' is void pointer and passing it to PTR_ALIGN() will cast the aligned pointer to void. Pass 'end' which is u64 pointer to PTR_ALIGN() instead so that the aligned pointer - 1 is the last 64-bit pointer to data.

---
 drivers/net/ethernet/broadcom/bnxt/bnxt.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +2 -1
index 8ab000d..82f1913 100644
@@ -248,7 +248,8 @@ static netdev_tx_t bnxt_start_xmit(struct sk_buff *skb, struct net_device *dev)
 		tx_push1->tx_bd_cfa_meta = cpu_to_le32(vlan_tag_flags);
 		tx_push1->tx_bd_cfa_action = cpu_to_le32(cfa_action);
 
-		end = PTR_ALIGN(pdata + length + 1, 8) - 1;
+		end = pdata + length;
+		end = PTR_ALIGN(end, 8) - 1;
 		*end = 0;
 
 		skb_copy_from_linear_data(skb, pdata, len);
Signature · 1 line
1.8.3.1
maintainer Applied
#1 lore raw

From: Michael Chan <[email protected]>
Date: Mon, 22 Feb 2016 02:10:26 -0500

Quoted 9 lines

The arithmetic to zero pad the last 64-bit word in the push buffer is not correct.

1. It should be pdata + length to get to the end.
2. 'pdata' is void pointer and passing it to PTR_ALIGN() will cast the aligned pointer to void. Pass 'end' which is u64 pointer to PTR_ALIGN() instead so that the aligned pointer - 1 is the last 64-bit pointer to data.

Applied, thanks Michael.