[PATCH] nvme: apple: Check memalign return value
Neil Armstrong
neil.armstrong at linaro.org
Tue May 19 11:43:21 CEST 2026
On 5/9/26 22:13, Francois Berder wrote:
> 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 at outlook.fr>
> ---
> 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 7e7538553e3..46af1d716ff 100644
> --- a/drivers/nvme/nvme_apple.c
> +++ b/drivers/nvme/nvme_apple.c
> @@ -87,6 +87,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) {
Reviewed-by: Neil Armstrong <neil.armstrong at linaro.org>
Thanks,
Neil
More information about the U-Boot
mailing list