Loading
test/unit/nvme: Fix dummy_cb signature
As per typedef in nvme.h the spdk_nvme_cpl argument should be a
pointer to a const struct.
This fixes runtimer error under clang >= 17.x which now makes the
-fsanitize=function available for C and which on our end is being
enabled via -fsanitize=undefined under UBSAN.
Error in question:
Test: test_spdk_nvme_detach ...passed
Test: test_nvme_completion_poll_cb ...passed
Test: test_nvme_user_copy_cmd_complete
.../root/spdk/lib/nvme/nvme.c:417:2: runtime error: call to function
dummy_cb through pointer to incorrect function type 'void (*)(void *,
const struct spdk_nvme_cpl *)'
/root/spdk/test/unit/lib/nvme/nvme.c/nvme_ut.c:584: note: dummy_cb
defined here
#0 0x5098e0 in nvme_user_copy_cmd_complete
/root/spdk/lib/nvme/nvme.c:417:2
#1 0x532161 in test_nvme_user_copy_cmd_complete
/root/spdk/test/unit/lib/nvme/nvme.c/nvme_ut.c:604:2
#2 0x7f08c952266a (/usr/lib64/libcunit.so.1+0x466a) (BuildId:
d99e3b60795f2ce01ada820b4b7e3cd84d8150fe)
#3 0x7f08c95229c7 (/usr/lib64/libcunit.so.1+0x49c7) (BuildId:
d99e3b60795f2ce01ada820b4b7e3cd84d8150fe)
#4 0x7f08c9523a9f in CU_run_all_tests
(/usr/lib64/libcunit.so.1+0x5a9f) (BuildId:
d99e3b60795f2ce01ada820b4b7e3cd84d8150fe)
#5 0x55555e in run_tests /root/spdk/lib/ut/ut.c:169:3
#6 0x552aec in spdk_ut_run_tests /root/spdk/lib/ut/ut.c:225:8
#7 0x522d52 in main
/root/spdk/test/unit/lib/nvme/nvme.c/nvme_ut.c:1664:17
#8 0x7f08c8c28149 in __libc_start_call_main
(/usr/lib64/libc.so.6+0x28149) (BuildId:
7ea8d85df0e89b90c63ac7ed2b3578b2e7728756)
#9 0x7f08c8c2820a in __libc_start_main@GLIBC_2.2.5
(/usr/lib64/libc.so.6+0x2820a) (BuildId:
7ea8d85df0e89b90c63ac7ed2b3578b2e7728756)
#10 0x42b6a4 in _start
(/root/spdk/test/unit/lib/nvme/nvme.c/nvme_ut+0x42b6a4)
(BuildId: 6fc2caaf777030becad2d0f660ec68443f3380b4)
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior
/root/spdk/lib/nvme/nvme.c:417:2 in
./test/unit/unittest.sh: line 85: 75349 Aborted (core
dumped) $valgrind $testdir/lib/nvme/nvme.c/nvme_ut
Change-Id: Iddbd5fc0dee0ef6a6cc1f032e079f6119e76aed9
Signed-off-by:
Michal Berger <michal.berger@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/22025
Reviewed-by:
Jim Harris <jim.harris@samsung.com>
Community-CI: Mellanox Build Bot
Reviewed-by:
Konrad Sztyber <konrad.sztyber@intel.com>
Tested-by:
SPDK CI Jenkins <sys_sgci@intel.com>