numam-dpdk/lib/librte_net
Andy Green f37a2e7c74 net: explicit cast in L4 checksum
GCC 8.1 warned:

In function 'rte_ipv4_udptcp_cksum':
rte_byteorder.h:51:24: warning: conversion from 'long unsigned int' to
'uint32_t' {aka 'unsigned int'} may change value [-Wconversion]
 #define rte_bswap16(x) ((uint16_t) (__builtin_constant_p(x) ?  \
                        ^
rte_byteorder.h:85:29: note: in expansion of macro 'rte_bswap16'
 #define rte_be_to_cpu_16(x) rte_bswap16(x)
                             ^~~~~~~~~~~
rte_ip.h:321:11: note: in expansion of macro 'rte_be_to_cpu_16'
  l4_len = rte_be_to_cpu_16(ipv4_hdr->total_length) -
           ^~~~~~~~~~~~~~~~

Also with this one, it is a cast that always occurred
and is just being done explicitly, with no changes to
the generated code.

The warning stack is misleading, it points to the last
element in the macro that produced the lhs of the subtraction
above.  But the only "unsigned long int" in the expression is
the result of the sizeof() on the rhs, it promotes the
subtraction result to unsigned long.  So the error actually
relates to the result of the outer subtraction.

The actual error is "you are trying to put an unsigned long
into a uint32_t".  We always did so, the fix is just to inform
the compiler it is intentional with an explicit cast.

Fixes: 6006818cfb ("net: new checksum functions")
Cc: stable@dpdk.org

Signed-off-by: Andy Green <andy@warmcat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2018-05-22 16:27:09 +02:00
..
Makefile net: export IPv6 header extensions skip function 2018-04-27 17:34:41 +01:00
meson.build net: export IPv6 header extensions skip function 2018-04-27 17:34:41 +01:00
net_crc_neon.h
net_crc_sse.h
rte_arp.c add experimental tag to appropriate functions 2018-01-29 23:35:29 +01:00
rte_arp.h
rte_esp.h
rte_ether.h net: explicit cast of multicast bit clearing 2018-05-21 00:21:24 +02:00
rte_gre.h
rte_icmp.h
rte_ip.h net: explicit cast in L4 checksum 2018-05-22 16:27:09 +02:00
rte_net_crc.c
rte_net_crc.h
rte_net_version.map lib: clear experimental version tag in linker scripts 2018-05-14 03:37:28 +02:00
rte_net.c net: export IPv6 header extensions skip function 2018-04-27 17:34:41 +01:00
rte_net.h net: export IPv6 header extensions skip function 2018-04-27 17:34:41 +01:00
rte_sctp.h
rte_tcp.h
rte_udp.h