提交 15dd16c2 编写于 作者: L Li RongQing 提交者: David S. Miller

cxgb3: Correct comparisons and calculations using skb->tail and skb-transport_header

This corrects an regression introduced by "net: Use 16bits for *_headers
fields of struct skbuff" when NET_SKBUFF_DATA_USES_OFFSET is not set. In
that case skb->tail will be a pointer whereas skb->transport_header
will be an offset from head. This is corrected by using wrappers that
ensure that comparisons and calculations are always made using pointers.

Cc: Simon Horman <horms@verge.net.au>
Signed-off-by: NLi RongQing <roy.qing.li@gmail.com>
Reviewed-by: NSimon Horman <horms@verge.net.au>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 00f97da1
...@@ -1583,7 +1583,7 @@ static void deferred_unmap_destructor(struct sk_buff *skb) ...@@ -1583,7 +1583,7 @@ static void deferred_unmap_destructor(struct sk_buff *skb)
dui = (struct deferred_unmap_info *)skb->head; dui = (struct deferred_unmap_info *)skb->head;
p = dui->addr; p = dui->addr;
if (skb->tail - skb->transport_header) if (skb_tail_pointer(skb) - skb_transport_header(skb))
pci_unmap_single(dui->pdev, *p++, skb_tail_pointer(skb) - pci_unmap_single(dui->pdev, *p++, skb_tail_pointer(skb) -
skb_transport_header(skb), PCI_DMA_TODEVICE); skb_transport_header(skb), PCI_DMA_TODEVICE);
......
...@@ -1294,7 +1294,7 @@ static inline unsigned int calc_tx_flits_ofld(const struct sk_buff *skb) ...@@ -1294,7 +1294,7 @@ static inline unsigned int calc_tx_flits_ofld(const struct sk_buff *skb)
flits = skb_transport_offset(skb) / 8U; /* headers */ flits = skb_transport_offset(skb) / 8U; /* headers */
cnt = skb_shinfo(skb)->nr_frags; cnt = skb_shinfo(skb)->nr_frags;
if (skb->tail != skb->transport_header) if (skb_tail_pointer(skb) != skb_transport_header(skb))
cnt++; cnt++;
return flits + sgl_len(cnt); return flits + sgl_len(cnt);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册