* [PATCH v2 1/2] PCI: hv: Remove unnecessary type casting from kzalloc
@ 2020-02-22 5:59 Dexuan Cui
2020-02-22 5:59 ` [PATCH v2 2/2] PCI: hv: Use kfree(hbus) in hv_pci_probe()'s error handling path Dexuan Cui
2020-02-24 12:04 ` [PATCH v2 1/2] PCI: hv: Remove unnecessary type casting from kzalloc Lorenzo Pieralisi
0 siblings, 2 replies; 3+ messages in thread
From: Dexuan Cui @ 2020-02-22 5:59 UTC (permalink / raw)
To: kys, haiyangz, sthemmin, lorenzo.pieralisi, bhelgaas,
linux-hyperv, linux-pci, linux-kernel, mikelley
Cc: Dexuan Cui
In C, there is no need to cast a void * to any other pointer type.
Fixes: 877b911a5ba0 ("PCI: hv: Avoid a kmemleak false positive caused by the hbus buffer")
Signed-off-by: Dexuan Cui <decui@microsoft.com>
Reviewed-by: Michael Kelley <mikelley@microsoft.com>
---
Change in v2: this was part of v1.
drivers/pci/controller/pci-hyperv.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c
index 9977abff92fc..0fe0283368d2 100644
--- a/drivers/pci/controller/pci-hyperv.c
+++ b/drivers/pci/controller/pci-hyperv.c
@@ -2922,7 +2922,7 @@ static int hv_pci_probe(struct hv_device *hdev,
* positive by using kmemleak_alloc() and kmemleak_free() to ask
* kmemleak to track and scan the hbus buffer.
*/
- hbus = (struct hv_pcibus_device *)kzalloc(HV_HYP_PAGE_SIZE, GFP_KERNEL);
+ hbus = kzalloc(HV_HYP_PAGE_SIZE, GFP_KERNEL);
if (!hbus)
return -ENOMEM;
hbus->state = hv_pcibus_init;
--
2.19.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* [PATCH v2 2/2] PCI: hv: Use kfree(hbus) in hv_pci_probe()'s error handling path
2020-02-22 5:59 [PATCH v2 1/2] PCI: hv: Remove unnecessary type casting from kzalloc Dexuan Cui
@ 2020-02-22 5:59 ` Dexuan Cui
2020-02-24 12:04 ` [PATCH v2 1/2] PCI: hv: Remove unnecessary type casting from kzalloc Lorenzo Pieralisi
1 sibling, 0 replies; 3+ messages in thread
From: Dexuan Cui @ 2020-02-22 5:59 UTC (permalink / raw)
To: kys, haiyangz, sthemmin, lorenzo.pieralisi, bhelgaas,
linux-hyperv, linux-pci, linux-kernel, mikelley
Cc: Dexuan Cui
Now that we use kzalloc() to allocate the hbus buffer, we should use
kfree() in the error path as well.
Fixes: 877b911a5ba0 ("PCI: hv: Avoid a kmemleak false positive caused by the hbus buffer")
Signed-off-by: Dexuan Cui <decui@microsoft.com>
Reviewed-by: Michael Kelley <mikelley@microsoft.com>
---
drivers/pci/controller/pci-hyperv.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Change in v2: this was part of v1.
diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c
index 0fe0283368d2..15011a349520 100644
--- a/drivers/pci/controller/pci-hyperv.c
+++ b/drivers/pci/controller/pci-hyperv.c
@@ -3058,7 +3058,7 @@ static int hv_pci_probe(struct hv_device *hdev,
free_dom:
hv_put_dom_num(hbus->sysdata.domain);
free_bus:
- free_page((unsigned long)hbus);
+ kfree(hbus);
return ret;
}
--
2.19.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH v2 1/2] PCI: hv: Remove unnecessary type casting from kzalloc
2020-02-22 5:59 [PATCH v2 1/2] PCI: hv: Remove unnecessary type casting from kzalloc Dexuan Cui
2020-02-22 5:59 ` [PATCH v2 2/2] PCI: hv: Use kfree(hbus) in hv_pci_probe()'s error handling path Dexuan Cui
@ 2020-02-24 12:04 ` Lorenzo Pieralisi
1 sibling, 0 replies; 3+ messages in thread
From: Lorenzo Pieralisi @ 2020-02-24 12:04 UTC (permalink / raw)
To: Dexuan Cui
Cc: kys, haiyangz, sthemmin, bhelgaas, linux-hyperv, linux-pci,
linux-kernel, mikelley
On Fri, Feb 21, 2020 at 09:59:56PM -0800, Dexuan Cui wrote:
> In C, there is no need to cast a void * to any other pointer type.
>
> Fixes: 877b911a5ba0 ("PCI: hv: Avoid a kmemleak false positive caused by the hbus buffer")
This patch fixes nothing, anyway, that's a leftover that I removed.
Applied the series to pci/hv for v5.7.
Thanks,
Lorenzo
> Signed-off-by: Dexuan Cui <decui@microsoft.com>
> Reviewed-by: Michael Kelley <mikelley@microsoft.com>
> ---
>
> Change in v2: this was part of v1.
>
> drivers/pci/controller/pci-hyperv.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c
> index 9977abff92fc..0fe0283368d2 100644
> --- a/drivers/pci/controller/pci-hyperv.c
> +++ b/drivers/pci/controller/pci-hyperv.c
> @@ -2922,7 +2922,7 @@ static int hv_pci_probe(struct hv_device *hdev,
> * positive by using kmemleak_alloc() and kmemleak_free() to ask
> * kmemleak to track and scan the hbus buffer.
> */
> - hbus = (struct hv_pcibus_device *)kzalloc(HV_HYP_PAGE_SIZE, GFP_KERNEL);
> + hbus = kzalloc(HV_HYP_PAGE_SIZE, GFP_KERNEL);
> if (!hbus)
> return -ENOMEM;
> hbus->state = hv_pcibus_init;
> --
> 2.19.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-02-24 12:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-02-22 5:59 [PATCH v2 1/2] PCI: hv: Remove unnecessary type casting from kzalloc Dexuan Cui
2020-02-22 5:59 ` [PATCH v2 2/2] PCI: hv: Use kfree(hbus) in hv_pci_probe()'s error handling path Dexuan Cui
2020-02-24 12:04 ` [PATCH v2 1/2] PCI: hv: Remove unnecessary type casting from kzalloc Lorenzo Pieralisi
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.