]> git.sur5r.net Git - u-boot/commitdiff
nvme: Fix wrong ndev->queues memset
authorBin Meng <bmeng.cn@gmail.com>
Sat, 2 Sep 2017 15:15:35 +0000 (08:15 -0700)
committerTom Rini <trini@konsulko.com>
Sun, 3 Sep 2017 19:30:32 +0000 (15:30 -0400)
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>
drivers/nvme/nvme.c

index ec32d0de27a1f1b7e4dcee80bfce5b1fb1889f47..4448754acace73efd7a628d779a2225061421e97 100644 (file)
@@ -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) {