[PATCH] PCI: endpoint: Fix epc windows allocation in pci_epc_multi_mem_init()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Fix allocation of epc windows with the correct size, this also fix smatch
warning:

drivers/pci/endpoint/pci-epc-mem.c:65 pci_epc_multi_mem_init()
warn: double check that we're allocating correct size: 4 vs 112

Fixes: ecbae87 ("PCI: endpoint: Add support to handle multiple base for mapping outbound memory")
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>
Reported-by: kbuild test robot <lkp@xxxxxxxxx>
Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
---
 drivers/pci/endpoint/pci-epc-mem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pci/endpoint/pci-epc-mem.c b/drivers/pci/endpoint/pci-epc-mem.c
index 2325f74..80c46f3 100644
--- a/drivers/pci/endpoint/pci-epc-mem.c
+++ b/drivers/pci/endpoint/pci-epc-mem.c
@@ -62,7 +62,7 @@ int pci_epc_multi_mem_init(struct pci_epc *epc,
 	if (!windows || !num_windows)
 		return -EINVAL;
 
-	epc->windows = kcalloc(num_windows, sizeof(*mem), GFP_KERNEL);
+	epc->windows = kcalloc(num_windows, sizeof(*epc->windows), GFP_KERNEL);
 	if (!epc->windows)
 		return -ENOMEM;
 
-- 
2.7.4




[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux