From: Jens Axboe Date: Mon, 13 Jan 2025 17:27:54 +0000 (-0700) Subject: nvme: fix bogus kzalloc() return check in nvme_init_effects_log() X-Git-Tag: v6.14-rc1~202^2~9 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=170e086ad3997f816d1f551f178a03a626a130b7;p=thirdparty%2Flinux.git nvme: fix bogus kzalloc() return check in nvme_init_effects_log() 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 --- diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 9e7f1bb819738..0d21258e22833 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -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);