This patch adds two checks for the X__elf_bytes bpf skeleton helper method. The first asserts that the pointer returned from the helper method is valid, the second asserts that the provided size pointer is set. Signed-off-by: Matt Smith <alastorze@xxxxxx> --- tools/testing/selftests/bpf/prog_tests/skeleton.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tools/testing/selftests/bpf/prog_tests/skeleton.c b/tools/testing/selftests/bpf/prog_tests/skeleton.c index f6f130c99b8c..963a4f5f596d 100644 --- a/tools/testing/selftests/bpf/prog_tests/skeleton.c +++ b/tools/testing/selftests/bpf/prog_tests/skeleton.c @@ -18,6 +18,9 @@ void test_skeleton(void) struct test_skeleton__data *data; struct test_skeleton__rodata *rodata; struct test_skeleton__kconfig *kcfg; + const void *eb; + size_t ebs_val = 0; + size_t *ebs = &ebs_val; skel = test_skeleton__open(); if (CHECK(!skel, "skel_open", "failed to open skeleton\n")) @@ -91,6 +94,10 @@ void test_skeleton(void) CHECK(bss->kern_ver != kcfg->LINUX_KERNEL_VERSION, "ext2", "got %d != exp %d\n", bss->kern_ver, kcfg->LINUX_KERNEL_VERSION); + eb = test_skeleton__elf_bytes(ebs); + ASSERT_OK_PTR(eb, "elf_bytes_not_null"); + ASSERT_NEQ(*ebs, 0, "elf_bytes_size_not_zero"); + cleanup: test_skeleton__destroy(skel); } -- 2.30.2