From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bin Meng Date: Tue, 22 Aug 2017 08:15:08 -0700 Subject: [U-Boot] [PATCH 03/14] nvme: Fix ndev->queues allocation In-Reply-To: <1503414919-30820-1-git-send-email-bmeng.cn@gmail.com> References: <1503414919-30820-1-git-send-email-bmeng.cn@gmail.com> Message-ID: <1503414919-30820-4-git-send-email-bmeng.cn@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de ndev->queues is a pointer to pointer, but the allocation wrongly requests sizeof(struct nvme_queue). Fix it. Signed-off-by: Bin Meng --- drivers/nvme/nvme.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/nvme/nvme.c b/drivers/nvme/nvme.c index 2ac0870..5d39cab 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) { -- 2.9.2