dbd8bdfc04
This is for target i686-native-linuxapp-gcc and gcc6, Compilation error is: In file included from include/rte_mempool.h:77:0, from drivers/net/virtio/virtio_rxtx_simple.c: In function `virtio_xmit_pkts_simple': include/rte_memcpy.h:551:2: error: array subscript is above array bounds rte_mov16((uint8_t *)dst + 1 * 16, (const uint8_t *)src + 1 * 16); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Call stack is as following: virtio_xmit_pkts_simple virtio_xmit_cleanup rte_mempool_put_bulk rte_mempool_generic_put __mempool_generic_put rte_memcpy The array used as source buffer in virtio_xmit_cleanup (free) is a pointer array with 32 elements, in 32bit this makes 128 bytes. in rte_memcpy() implementation, there a code piece as following: if (size > 256) { rte_move128(...); rte_move128(...); <--- [1] .... } The compiler traces the array all through the call stack and knows the size of array is 128 and generates a warning on above [1] which tries to access beyond byte 128. But unfortunately it ignores the "(size > 256)" check. Giving a hint to compiler that variable "size" is related to the size of the source buffer fixes compiler warning. Fixes: 863bfb474493 ("mempool: optimize copy in cache") Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com> Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>