* [PATCH net] bnxt_en: Fix zero padding of tx push data.
@ 2016-02-22 7:10 Michael Chan
2016-02-24 0:13 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Michael Chan @ 2016-02-22 7:10 UTC (permalink / raw)
To: davem; +Cc: netdev
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.
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
---
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index 8ab000d..82f1913 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -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);
--
1.8.3.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net] bnxt_en: Fix zero padding of tx push data.
2016-02-22 7:10 [PATCH net] bnxt_en: Fix zero padding of tx push data Michael Chan
@ 2016-02-24 0:13 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2016-02-24 0:13 UTC (permalink / raw)
To: michael.chan; +Cc: netdev
From: Michael Chan <michael.chan@broadcom.com>
Date: Mon, 22 Feb 2016 02:10:26 -0500
> 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.
>
> Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Applied, thanks Michael.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-02-24 0:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-22 7:10 [PATCH net] bnxt_en: Fix zero padding of tx push data Michael Chan
2016-02-24 0:13 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).