odp_buffer_encode_handle initializes only the useful bits but not all of them 
which causes error in valgrind:
==1192== Conditional jump or move depends on uninitialised value(s)
==1192==    at 0x40CB01: odp_timeout_alloc (odp_timer.c:861)
==1192==    by 0x402A2A: test_timeout_pool_alloc (odp_timer.c:72)
==1192==    by 0x4C17406: ??? (in /usr/lib64/libcunit.so.1.0.1)
==1192==    by 0x4C17762: ??? (in /usr/lib64/libcunit.so.1.0.1)
==1192==    by 0x4C17A95: CU_run_all_tests (in /usr/lib64/libcunit.so.1.0.1)
==1192==    by 0x401E25: main (odp_cunit_common.c:77)
==1192==  Uninitialised value was created by a stack allocation
==1192==    at 0x4074EC: odp_pool_create (odp_pool.c:153)

This mainly happens when testing odp_buffer_t vs ODP_BUFFER_INVALID. The test 
works but it fills the test logs with warnings.
By setting the wholme odp_buffer_t at 0, the errors disappear.

Signed-off-by: Nicolas Morey-Chaisemartin <nmo...@kalray.eu>
---
 platform/linux-generic/include/odp_buffer_inlines.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/platform/linux-generic/include/odp_buffer_inlines.h 
b/platform/linux-generic/include/odp_buffer_inlines.h
index 4a44c5f..2c792e2 100644
--- a/platform/linux-generic/include/odp_buffer_inlines.h
+++ b/platform/linux-generic/include/odp_buffer_inlines.h
@@ -26,6 +26,7 @@ static inline odp_buffer_t 
odp_buffer_encode_handle(odp_buffer_hdr_t *hdr)
        uint32_t pool_id = pool_handle_to_index(hdr->pool_hdl);
        struct pool_entry_s *pool = get_pool_entry(pool_id);
 
+       handle.handle = 0;
        handle.pool_id = pool_id;
        handle.index = ((uint8_t *)hdr - pool->pool_mdata_addr) /
                ODP_CACHE_LINE_SIZE;
_______________________________________________
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to