]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
nvme: fix bogus kzalloc() return check in nvme_init_effects_log()
authorJens Axboe <axboe@kernel.dk>
Mon, 13 Jan 2025 17:27:54 +0000 (10:27 -0700)
committerJens Axboe <axboe@kernel.dk>
Mon, 13 Jan 2025 17:27:54 +0000 (10:27 -0700)
nvme_init_effects_log() returns failure when kzalloc() is successful,
which is obviously wrong and causes failures to boot. Correct the
check.

Fixes: d4a95adeabc6 ("nvme: Add error path for xa_store in nvme_init_effects")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/nvme/host/core.c

index 9e7f1bb8197380048c78f16f627eacf4ec689e18..0d21258e22833369ff218e6bf1138588edf8f0da 100644 (file)
@@ -3182,7 +3182,7 @@ static int nvme_init_effects_log(struct nvme_ctrl *ctrl,
        struct nvme_effects_log *effects, *old;
 
        effects = kzalloc(sizeof(*effects), GFP_KERNEL);
-       if (effects)
+       if (!effects)
                return -ENOMEM;
 
        old = xa_store(&ctrl->cels, csi, effects, GFP_KERNEL);