[U-Boot] [PATCH 1/3] nvme: Fix wrong ndev->queues memset

Bin Meng bmeng.cn at gmail.com
Sat Sep 2 15:15:35 UTC 2017


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 at gmail.com>
---

 drivers/nvme/nvme.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/nvme/nvme.c b/drivers/nvme/nvme.c
index ec32d0d..4448754 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) {
-- 
2.9.2



More information about the U-Boot mailing list