]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mlx4_vnic: Add correct typecasting to pointers in vnic_get_frag_header()
authorAshish Samant <ashish.samant@oracle.com>
Tue, 7 Oct 2014 18:21:35 +0000 (11:21 -0700)
committerMukesh Kacker <mukesh.kacker@oracle.com>
Tue, 7 Jul 2015 21:58:50 +0000 (14:58 -0700)
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 <ashish.samant@oracle.com>
Acked-by: Rama Nichanamatlu <rama.nichanamatlu@oracle.com>
Signed-off-by: Guangyu Sun <guangyu.sun@oracle.com>
drivers/net/ethernet/mellanox/mlx4_vnic/vnic_data_netdev.c

index 9c549dc4a76d76a0be3f9d3540844847d26f1a15..4453abca82b0ebfba5a909b97d26c754fb192710 100644 (file)
@@ -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;