From: Jens Axboe <axboe@kernel.dk>
To: "linux-nvme@lists.infradead.org" <linux-nvme@lists.infradead.org>
Cc: Keith Busch <kbusch@kernel.org>, Christoph Hellwig <hch@lst.de>,
Sagi Grimberg <sagi@grimberg.me>,
keisuke.nishimura@inria.fr
Subject: [PATCH] nvme: fix bogus kzalloc() return check in nvme_init_effects_log()
Date: Mon, 13 Jan 2025 10:30:06 -0700 [thread overview]
Message-ID: <9516d209-712a-4a48-9dda-b270e80e3abb@kernel.dk> (raw)
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>
---
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);
--
Jens Axboe
next reply other threads:[~2025-01-13 17:30 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-13 17:30 Jens Axboe [this message]
2025-01-13 17:39 ` [PATCH] nvme: fix bogus kzalloc() return check in nvme_init_effects_log() Keith Busch
2025-01-13 18:00 ` Jens Axboe
2025-01-13 17:46 ` Keisuke Nishimura
2025-01-13 20:01 ` Chaitanya Kulkarni
2025-01-13 20:03 ` Sagi Grimberg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9516d209-712a-4a48-9dda-b270e80e3abb@kernel.dk \
--to=axboe@kernel.dk \
--cc=hch@lst.de \
--cc=kbusch@kernel.org \
--cc=keisuke.nishimura@inria.fr \
--cc=linux-nvme@lists.infradead.org \
--cc=sagi@grimberg.me \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.