]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
dm vdo flush: initialize return to NULL in allocate_flush
authorMike Snitzer <snitzer@kernel.org>
Sun, 11 Feb 2024 19:07:18 +0000 (14:07 -0500)
committerMike Snitzer <snitzer@kernel.org>
Mon, 4 Mar 2024 20:07:55 +0000 (15:07 -0500)
Otherwise, error path could result in allocate_flush's subsequent
check for flush being non-NULL leading to false positive.

Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Susan LeGendre-McGhee <slegendr@redhat.com>
Signed-off-by: Matthew Sakai <msakai@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@kernel.org>
drivers/md/dm-vdo/flush.c

index 330b18715027e3abfee004fc14b6333845498c34..391b6203efc6ded7fc05815c65eed5a14318a38a 100644 (file)
@@ -100,7 +100,7 @@ static struct vdo_flush *vdo_waiter_as_flush(struct vdo_waiter *waiter)
 
 static void *allocate_flush(gfp_t gfp_mask, void *pool_data)
 {
-       struct vdo_flush *flush;
+       struct vdo_flush *flush = NULL;
 
        if ((gfp_mask & GFP_NOWAIT) == GFP_NOWAIT) {
                flush = uds_allocate_memory_nowait(sizeof(struct vdo_flush), __func__);