diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2024-04-24 14:45:12 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2024-04-24 16:15:05 -0400 |
commit | 19189e3f6f18b13e4f9c947c99062e658e98827d (patch) | |
tree | 898fdf0985d7be15b745d17e96a9a45b5afcbc05 /src/ioq.c | |
parent | 32e50c2faa3e48acb2eae29c23feb5511df2f9ab (diff) | |
download | bfs-19189e3f6f18b13e4f9c947c99062e658e98827d.tar.xz |
ioq: Fix uninitialized values in ioq_create() cleanup path
I switched from ZALLOC_FLEX() to ALLOC_FLEX() in hopes that msan would
catch uninitialized values in ioq_thread_create(), but in doing so,
forgot to initialize all fields before the first goto fail.
Fixes: f64f76b ("ioq: Copy ring_ops from the previous thread")
Diffstat (limited to 'src/ioq.c')
-rw-r--r-- | src/ioq.c | 5 |
1 files changed, 1 insertions, 4 deletions
@@ -918,17 +918,14 @@ static void ioq_thread_join(struct ioq_thread *thread) { } struct ioq *ioq_create(size_t depth, size_t nthreads) { - struct ioq *ioq = ALLOC_FLEX(struct ioq, threads, nthreads); + struct ioq *ioq = ZALLOC_FLEX(struct ioq, threads, nthreads); if (!ioq) { goto fail; } ioq->depth = depth; - ioq->size = 0; - ioq->cancel = false; ARENA_INIT(&ioq->ents, struct ioq_ent); - #if BFS_USE_LIBURING && BFS_USE_STATX ARENA_INIT(&ioq->xbufs, struct statx); #endif |