From: Ashish Samant Date: Tue, 7 Oct 2014 18:21:35 +0000 (-0700) Subject: mlx4_vnic: Add correct typecasting to pointers in vnic_get_frag_header() X-Git-Tag: v4.1.12-92~293^2~1^2~15 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=affda11e0ed1dbe193a4fe66768dac8062181000;p=users%2Fjedix%2Flinux-maple.git mlx4_vnic: Add correct typecasting to pointers in vnic_get_frag_header() The *mac_hdr (Mac Header) pointer should be incremented ETH_HLEN bytes to get the *ip_hdr (IP Header) pointer. Similarly, the IP Header pointer should be incremented by (iph->ihl << 2) bytes to get the *tcpudp_hdr (Transport Header) pointer. Fix this by adding a u8* cast to the two pointers while doing the pointer arithmetic. Orabug: 19824501 Signed-off-by: Ashish Samant Acked-by: Rama Nichanamatlu Signed-off-by: Guangyu Sun --- diff --git a/drivers/net/ethernet/mellanox/mlx4_vnic/vnic_data_netdev.c b/drivers/net/ethernet/mellanox/mlx4_vnic/vnic_data_netdev.c index 9c549dc4a76d7..4453abca82b0e 100644 --- a/drivers/net/ethernet/mellanox/mlx4_vnic/vnic_data_netdev.c +++ b/drivers/net/ethernet/mellanox/mlx4_vnic/vnic_data_netdev.c @@ -888,8 +888,8 @@ static int vnic_get_frag_header(struct skb_frag_struct *frags, void **mac_hdr, { struct iphdr *iph; *mac_hdr = page_address(frags->page.p) + frags->page_offset; - *ip_hdr = iph = (struct iphdr *)(*mac_hdr + ETH_HLEN); - *tcpudp_hdr = (struct tcphdr *)(iph + (iph->ihl << 2)); + *ip_hdr = iph = (struct iphdr *)((u8*)(*mac_hdr) + ETH_HLEN); + *tcpudp_hdr = (struct tcphdr *)((u8*)(iph) + (iph->ihl << 2)); *hdr_flags = LRO_IPV4 | LRO_TCP; return 0;