From: Razvan Deaconescu Date: Fri, 12 May 2023 22:28:57 +0000 (+0300) Subject: lib/vfscore: Initialize lists for stdio_vnode X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=refs%2Fheads%2Finit-stdio-list;p=unikraft%2Funikraft.git lib/vfscore: Initialize lists for stdio_vnode 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 --- diff --git a/lib/vfscore/stdio.c b/lib/vfscore/stdio.c index b01c29e2c..c48efe3e3 100644 --- a/lib/vfscore/stdio.c +++ b/lib/vfscore/stdio.c @@ -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, };