From: Bin Meng Date: Tue, 22 Aug 2017 15:15:08 +0000 (-0700) Subject: nvme: Fix ndev->queues allocation X-Git-Tag: v2017.09-rc3~15 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=099c2015b02352df9c829acbdc3d8e6e683011a5;p=u-boot nvme: Fix ndev->queues allocation ndev->queues is a pointer to pointer, but the allocation wrongly requests sizeof(struct nvme_queue). Fix it. Signed-off-by: Bin Meng --- diff --git a/drivers/nvme/nvme.c b/drivers/nvme/nvme.c index 2ac0870ae6..5d39cab90d 100644 --- a/drivers/nvme/nvme.c +++ b/drivers/nvme/nvme.c @@ -785,13 +785,13 @@ static int nvme_probe(struct udevice *udev) goto free_nvme; } - ndev->queues = malloc(2 * sizeof(struct nvme_queue)); + ndev->queues = malloc(2 * sizeof(struct nvme_queue *)); if (!ndev->queues) { ret = -ENOMEM; printf("Error: %s: Out of memory!\n", udev->name); goto free_nvme; } - memset(ndev->queues, 0, sizeof(2 * sizeof(struct nvme_queue))); + memset(ndev->queues, 0, sizeof(2 * sizeof(struct nvme_queue *))); ndev->prp_pool = malloc(MAX_PRP_POOL); if (!ndev->prp_pool) {