aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBin Meng2017-09-02 08:15:35 -0700
committerTom Rini2017-09-03 15:30:32 -0400
commit37d46870b31724b71f593de3eda274e9ad8026d4 (patch)
treede32c2bb5ab6349c60e4156d075e338ff5c20cb0
parent5eae466ea1ebd79c8033d4686242d5971a86bf74 (diff)
nvme: Fix wrong ndev->queues memset
memset() was given a sizeof(NVME_Q_NUM * sizeof(struct nvme_queue *) to clear, which is wrong. Reported-by: Coverity (CID: 166729) Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Tom Rini <trini@konsulko.com>
-rw-r--r--drivers/nvme/nvme.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/nvme/nvme.c b/drivers/nvme/nvme.c
index ec32d0de27a..4448754acac 100644
--- a/drivers/nvme/nvme.c
+++ b/drivers/nvme/nvme.c
@@ -791,8 +791,7 @@ static int nvme_probe(struct udevice *udev)
printf("Error: %s: Out of memory!\n", udev->name);
goto free_nvme;
}
- memset(ndev->queues, 0,
- sizeof(NVME_Q_NUM * sizeof(struct nvme_queue *)));
+ memset(ndev->queues, 0, NVME_Q_NUM * sizeof(struct nvme_queue *));
ndev->prp_pool = malloc(MAX_PRP_POOL);
if (!ndev->prp_pool) {