]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
nvme: apple: Check memalign return value
authorFrancois Berder <fberder@outlook.fr>
Sat, 9 May 2026 20:13:31 +0000 (22:13 +0200)
committerNeil Armstrong <neil.armstrong@linaro.org>
Wed, 20 May 2026 07:44:37 +0000 (09:44 +0200)
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 <fberder@outlook.fr>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://patch.msgid.link/BESP194MB280542535B098A33C8A815EEDA3A2@BESP194MB2805.EURP194.PROD.OUTLOOK.COM
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
drivers/nvme/nvme_apple.c

index 3e7d95c2b54667cf0228bd98df18525bd713f9c6..e674eda83445027f739361e0960f5b898728e663 100644 (file)
@@ -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) {