From 63f0f19803ee28a3612dfbef719ae7bac5143eef Mon Sep 17 00:00:00 2001 From: Francois Berder Date: Sat, 9 May 2026 22:13:31 +0200 Subject: [PATCH] nvme: apple: Check memalign return value memalign returns NULL if it fails. This commit ensures that we handle this failure before filling the buffer with 0s. Signed-off-by: Francois Berder Reviewed-by: Neil Armstrong Link: https://patch.msgid.link/BESP194MB280542535B098A33C8A815EEDA3A2@BESP194MB2805.EURP194.PROD.OUTLOOK.COM Signed-off-by: Neil Armstrong --- drivers/nvme/nvme_apple.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/nvme/nvme_apple.c b/drivers/nvme/nvme_apple.c index 3e7d95c2b54..e674eda8344 100644 --- a/drivers/nvme/nvme_apple.c +++ b/drivers/nvme/nvme_apple.c @@ -88,6 +88,9 @@ static int apple_nvme_setup_queue(struct nvme_queue *nvmeq) } priv->tcbs[nvmeq->qid] = (void *)memalign(4096, ANS_NVMMU_TCB_SIZE); + if (!priv->tcbs[nvmeq->qid]) + return -ENOMEM; + memset((void *)priv->tcbs[nvmeq->qid], 0, ANS_NVMMU_TCB_SIZE); switch (nvmeq->qid) {