[PATCH] nvme: fix bogus kzalloc() return check in nvme_init_effects_log()
Keisuke Nishimura
keisuke.nishimura at inria.fr
Mon Jan 13 09:46:37 PST 2025
On 13/01/2025 18:30, Jens Axboe wrote:
> nvme_init_effects_log() returns failure when kzalloc() is successful,
> which is obviously wrong and causes failures to boot. Correct the
> check.
Sorry, I should have checked more carefully here... Thank you for this fix.
Keisuke
>
> Fixes: d4a95adeabc6 ("nvme: Add error path for xa_store in nvme_init_effects")
> Signed-off-by: Jens Axboe <axboe at kernel.dk>
>
> ---
>
> Caused a boot failure on the first test system I tried. Not sure how
> this got this far without being seen...
>
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index 9e7f1bb81973..0d21258e2283 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);
>
More information about the Linux-nvme
mailing list