]> xenbits.xensource.com Git - unikraft/unikraft.git/commitdiff
lib/vfscore: Initialize lists for stdio_vnode init-stdio-list 889/head
authorRazvan Deaconescu <razvand@unikraft.io>
Fri, 12 May 2023 22:28:57 +0000 (01:28 +0300)
committerRazvan Deaconescu <razvand@unikraft.io>
Fri, 12 May 2023 22:30:21 +0000 (01:30 +0300)
The VFS `struct vnode` structure has two `uk_list_head` members:
`v_link` and `v_names`. These need to be initialized by a dedicated
macro / function, such as `UK_LIST_HEAD_INIT`.

The `stdio_vnode` variable (of type `struct vnode`) is not initializing
these members (they are filled with zeros). This will cause crashes when
using them.

This commit fixes that by properly initializing the `v_link` and
`v_names` members of the `stdio_vnode` variable.

Signed-off-by: Razvan Deaconescu <razvand@unikraft.io>
lib/vfscore/stdio.c

index b01c29e2c5b5961847470e21afbfed1382a9a208..c48efe3e3ec41213a49c489a23a28d57d3f28be0 100644 (file)
@@ -206,6 +206,8 @@ static struct vnode stdio_vnode = {
        .v_op = &stdio_vnops,
        .v_lock = UK_MUTEX_INITIALIZER(stdio_vnode.v_lock),
        .v_refcnt = 1,
+       .v_link = UK_LIST_HEAD_INIT(stdio_vnode.v_link),
+       .v_names = UK_LIST_HEAD_INIT(stdio_vnode.v_names),
        .v_type = VCHR,
 };