nvme: fix bogus kzalloc() return check in nvme_init_effects_log()
Jens Axboe
maintainerPATCH 1/1 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.
---
Caused a boot failure on the first test system I tried. Not sure how this got this far without being seen...
drivers/nvme/host/core.c +1 -1
@@ -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 );
Signature · 1 line
Jens Axboe
Quoted 6 lines · Jens Axboe
nvme_init_effects_log()returns failure whenkzalloc()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 <[email protected]>
Oops. Thanks for the fix
Also applied to nvme-6.14, but feel free to take it directly to block/for-6.14.
Quoted 2 lines
Caused a boot failure on the first test system I tried. Not sure how this got this far without being seen...
I think we've a gap in our blktests for checking driver backward compatibility. The devices we test against support the Effects log, so we didn't see this fallback path for older spec revision devices tested out.
Jens Axboe
maintainerQuoted 8 lines · Keith Busch
Quoted 6 lines · Jens Axboe
nvme_init_effects_log()returns failure whenkzalloc()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 <[email protected]>
Quoted 6 lines
Oops. Thanks for the fix
Reviewed-by Keith Busch <[email protected]>Also applied to nvme-6.14, but feel free to take it directly to
block/for-6.14.
I did, figured that was easier. And if it fails on the one test system I tested on, guessing it'd break someone using linux-next as well. Hence let's just shove it in and move on.
Signature · 1 line
Jens Axboe
Quoted 3 lines · Jens Axboe
nvme_init_effects_log()returns failure whenkzalloc()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
Quoted 23 lines
Fixes d4a95adeabc6 ("nvme: Add error path for xa_store in nvme_init_effects")Signed-off-by Jens Axboe <[email protected]>---
Caused a boot failure on the first test system I tried. Not sure how this got this far without being seen...
drivers/nvme/host/core.c +1
-1@@ -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 );
Quoted 6 lines · Jens Axboe
nvme_init_effects_log()returns failure whenkzalloc()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<[email protected]>
Looks good.
-ck