Skip to content

Commit

Permalink
cxgb3: Fix length calculation in write_ofld_wr() on 32-bit architectures
Browse files Browse the repository at this point in the history
The length calculation here is now invalid on 32-bit architectures,
since sk_buff::tail is a pointer and sk_buff::transport_header is
an integer offset:

drivers/net/ethernet/chelsio/cxgb3/sge.c: In function 'write_ofld_wr':
drivers/net/ethernet/chelsio/cxgb3/sge.c:1603:9: warning: passing argument 4 of 'make_sgl' makes integer from pointer without a cast [enabled by default]
         adap->pdev);
         ^
drivers/net/ethernet/chelsio/cxgb3/sge.c:964:28: note: expected 'unsigned int' but argument is of type 'sk_buff_data_t'
 static inline unsigned int make_sgl(const struct sk_buff *skb,
                            ^

Use the appropriate skb accessor functions.

Compile-tested only.

Signed-off-by: Ben Hutchings <[email protected]>
Fixes: 1a37e41 ('net: Use 16bits for *_headers fields of struct skbuff')
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
bwhacks authored and davem330 committed Oct 29, 2013
1 parent 826cb7b commit 262e827
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/net/ethernet/chelsio/cxgb3/sge.c
Original file line number Diff line number Diff line change
Expand Up @@ -1599,7 +1599,8 @@ static void write_ofld_wr(struct adapter *adap, struct sk_buff *skb,
flits = skb_transport_offset(skb) / 8;
sgp = ndesc == 1 ? (struct sg_ent *)&d->flit[flits] : sgl;
sgl_flits = make_sgl(skb, sgp, skb_transport_header(skb),
skb->tail - skb->transport_header,
skb_tail_pointer(skb) -
skb_transport_header(skb),
adap->pdev);
if (need_skb_unmap()) {
setup_deferred_unmapping(skb, adap->pdev, sgp, sgl_flits);
Expand Down

0 comments on commit 262e827

Please sign in to comment.