tests: lib: fdtable: Fix invalid memory access
The vtable cannot point to address 1 as that is clearly not a valid address and will fail when the code tries to access it in various fdtable.c functions. Point the vtable in tests either to NULL or to a valid vtable. Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This commit is contained in:
parent
ef074d9786
commit
283861cbfd
1 changed files with 4 additions and 2 deletions
|
@ -15,7 +15,9 @@
|
|||
static struct k_thread fd_thread;
|
||||
static int shared_fd;
|
||||
|
||||
#define VTABLE_INIT ((const struct fd_op_vtable *)1)
|
||||
static struct fd_op_vtable fd_vtable = { 0 };
|
||||
|
||||
#define VTABLE_INIT (&fd_vtable)
|
||||
|
||||
K_THREAD_STACK_DEFINE(fd_thread_stack, CONFIG_ZTEST_STACKSIZE +
|
||||
CONFIG_TEST_EXTRA_STACKSIZE);
|
||||
|
@ -60,7 +62,7 @@ void test_z_get_fd_obj(void)
|
|||
zassert_is_null(obj, "obj not is NULL");
|
||||
|
||||
obj = (void *)1;
|
||||
vtable = (const struct fd_op_vtable *)1;
|
||||
vtable = NULL;
|
||||
|
||||
/* This will set obj and vtable properly */
|
||||
z_finalize_fd(fd, obj, vtable);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue