* [PATCH] PCI: endpoint: Fix epc windows allocation in pci_epc_multi_mem_init()
@ 2020-05-19 15:11 Lad Prabhakar
2020-05-22 11:37 ` Lorenzo Pieralisi
0 siblings, 1 reply; 2+ messages in thread
From: Lad Prabhakar @ 2020-05-19 15:11 UTC (permalink / raw)
To: Kishon Vijay Abraham I, Lorenzo Pieralisi, Bjorn Helgaas
Cc: linux-pci, linux-kernel, Prabhakar, Lad Prabhakar
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@bp.renesas.com>
Reported-by: kbuild test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
---
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] PCI: endpoint: Fix epc windows allocation in pci_epc_multi_mem_init()
2020-05-19 15:11 [PATCH] PCI: endpoint: Fix epc windows allocation in pci_epc_multi_mem_init() Lad Prabhakar
@ 2020-05-22 11:37 ` Lorenzo Pieralisi
0 siblings, 0 replies; 2+ messages in thread
From: Lorenzo Pieralisi @ 2020-05-22 11:37 UTC (permalink / raw)
To: Lad Prabhakar
Cc: Kishon Vijay Abraham I, Bjorn Helgaas, linux-pci, linux-kernel,
Prabhakar
On Tue, May 19, 2020 at 04:11:20PM +0100, Lad Prabhakar wrote:
> 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@bp.renesas.com>
> Reported-by: kbuild test robot <lkp@intel.com>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> drivers/pci/endpoint/pci-epc-mem.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Squashed in the original commit in pci/rcar, pushed out.
Thanks,
Lorenzo
> 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
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-05-22 11:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-19 15:11 [PATCH] PCI: endpoint: Fix epc windows allocation in pci_epc_multi_mem_init() Lad Prabhakar
2020-05-22 11:37 ` Lorenzo Pieralisi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).