summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJieqiang Wang <jieqiang.wang@arm.com>2020-12-15 13:20:15 +0000
committerDamjan Marion <dmarion@me.com>2020-12-19 09:59:25 +0000
commit3daf1f5d3a5918564ae2acdd748b24acaef5bce0 (patch)
tree84b497fe557a5e9e165f1b281648dcec669d0fb5
parentee6b0e2904ee5123198ffe26a7de3019e16332b2 (diff)
avf: fix gcc compiling warning on Arm
Initializing struct avf_ip6_psh by {0} using gcc with O2 optimize option will trigger the -Werror=maybe-uninitialized compiling warning on Arm because gcc compiler will think some members of the struct avf_ip6_psh may not be initialized, which probably is a false positive in this case. The compiling error log is shown as below. Avoid this compiling warning by explicitly declaring the IPv6 src and dst ip in avf_ip6_psh as ip6_address_t. ccache /usr/lib/ccache/gcc-10 -DHAVE_FCNTL64 -DHAVE_GETCPU -DHAVE_MEMFD_CREATE -I/home/snowball/tasks/test_vpp_build/test-patch-9/vpp/src -I. -Iinclude -I/home/snowball/tasks/test_vpp_build/test-patch-9/vpp/src/plugins -Iplugins -Iplugins/avf -Wno-address-of-packed-member -g -fPIC -Werror -Wall -march=armv8-a+crc -O2 -fstack-protector -DFORTIFY_SOURCE=2 -fno-common -fPIC -DCLIB_MARCH_VARIANT=cortexa72 -march=armv8-a+crc+crypto -mtune=cortex-a72 -DCLIB_N_PREFETCHES=6 -MD -MT plugins/avf/CMakeFiles/avf_plugin_cortexa72.dir/output.c.o -MF plugins/avf/CMakeFiles/avf_plugin_cortexa72.dir/output.c.o.d -o plugins/avf/CMakeFiles/avf_plugin_cortexa72.dir/output.c.o -c /home/snowball/tasks/test_vpp_build/test-patch-9/vpp/src/plugins/avf/output.c In file included from /home/snowball/tasks/test_vpp_build/test-patch-9/vpp/src/vppinfra/vector_funcs.h:41, from /home/snowball/tasks/test_vpp_build/test-patch-9/vpp/src/vppinfra/vector.h:196, from /home/snowball/tasks/test_vpp_build/test-patch-9/vpp/src/vppinfra/string.h:48, from /home/snowball/tasks/test_vpp_build/test-patch-9/vpp/src/vppinfra/mem.h:49, from /home/snowball/tasks/test_vpp_build/test-patch-9/vpp/src/vppinfra/vec.h:42, from /home/snowball/tasks/test_vpp_build/test-patch-9/vpp/src/vppinfra/format.h:44, from /home/snowball/tasks/test_vpp_build/test-patch-9/vpp/src/vppinfra/elf.h:41, from /home/snowball/tasks/test_vpp_build/test-patch-9/vpp/src/vppinfra/elf_clib.h:41, from /home/snowball/tasks/test_vpp_build/test-patch-9/vpp/src/vlib/vlib.h:44, from /home/snowball/tasks/test_vpp_build/test-patch-9/vpp/src/plugins/avf/output.c:18: /home/snowball/tasks/test_vpp_build/test-patch-9/vpp/src/plugins/avf/output.c: In function ‘avf_device_class_tx_fn_cortexa72’: /home/snowball/tasks/test_vpp_build/test-patch-9/vpp/src/vppinfra/byte_order.h:59:10: error: ‘*((void *)&psh+32)’ may be used uninitialized in this function [-Werror=maybe-uninitialized] 59 | return __builtin_bswap16 (x); | ^~~~~~~~~~~~~~~~~~~~~ /home/snowball/tasks/test_vpp_build/test-patch-9/vpp/src/plugins/avf/output.c:115:23: note: ‘*((void *)&psh+32)’ was declared here 115 | struct avf_ip6_psh psh = { 0 }; | ^~~ Type: fix Change-Id: I2684b101b07823dfacc4a56cc29d152828d0cf37 Signed-off-by: Jieqiang Wang <jieqiang.wang@arm.com>
-rw-r--r--src/plugins/avf/output.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/plugins/avf/output.c b/src/plugins/avf/output.c
index cbc85b846fe..55a01c76fb1 100644
--- a/src/plugins/avf/output.c
+++ b/src/plugins/avf/output.c
@@ -47,8 +47,8 @@ struct avf_ip4_psh
struct avf_ip6_psh
{
- u32 src[4];
- u32 dst[4];
+ ip6_address_t src;
+ ip6_address_t dst;
u32 l4len;
u32 proto;
};
@@ -113,8 +113,8 @@ avf_tx_prepare_cksum (vlib_buffer_t * b, u8 is_tso)
else
{
struct avf_ip6_psh psh = { 0 };
- clib_memcpy_fast (&psh.src, &ip6->src_address, 16);
- clib_memcpy_fast (&psh.dst, &ip6->dst_address, 16);
+ psh.src = ip6->src_address;
+ psh.dst = ip6->dst_address;
psh.proto = clib_host_to_net_u32 ((u32) ip6->protocol);
psh.l4len = is_tso ? 0 : ip6->payload_length;
sum = ~ip_csum (&psh, sizeof (psh));