All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] PCI: hv: fix alloc_cast.cocci warnings
  2019-12-03  7:34 [linux-next:master 13591/14582] drivers/pci/controller/pci-hyperv.c:2925:9-32: WARNING: casting value returned by memory allocation function to (struct hv_pcibus_device *) is useless kbuild test robot
@ 2019-12-03  7:34   ` kbuild test robot
  0 siblings, 0 replies; 3+ messages in thread
From: kbuild test robot @ 2019-12-03  7:34 UTC (permalink / raw)
  To: Dexuan Cui
  Cc: kbuild-all, Lorenzo Pieralisi, Michael Kelley, K. Y. Srinivasan,
	Haiyang Zhang, Stephen Hemminger, Sasha Levin, Andrew Murray,
	Bjorn Helgaas, linux-hyperv

From: kbuild test robot <lkp@intel.com>

drivers/pci/controller/pci-hyperv.c:2925:9-32: WARNING: casting value returned by memory allocation function to (struct hv_pcibus_device *) is useless.

 Remove casting the values returned by memory allocation functions
 like kmalloc, kzalloc, kmem_cache_alloc, kmem_cache_zalloc etc.

Semantic patch information:
 This makes an effort to find cases of casting of values returned by
 kmalloc, kzalloc, kcalloc, kmem_cache_alloc, kmem_cache_zalloc,
 kmem_cache_alloc_node, kmalloc_node and kzalloc_node and removes
 the casting as it is not required. The result in the patch case may
 need some reformatting.

Generated by: scripts/coccinelle/api/alloc/alloc_cast.cocci

Fixes: 877b911a5ba0 ("PCI: hv: Avoid a kmemleak false positive caused by the hbus buffer")
CC: Dexuan Cui <decui@microsoft.com>
Signed-off-by: kbuild test robot <lkp@intel.com>
---

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   1ab75b2e415a29dba9aec94f203c6f88dbfc0ba0
commit: 877b911a5ba0733f62239055ee869f2e117b57da [13591/14582] PCI: hv: Avoid a kmemleak false positive caused by the hbus buffer

 pci-hyperv.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- 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
 	 * 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;

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [linux-next:master 13591/14582] drivers/pci/controller/pci-hyperv.c:2925:9-32: WARNING: casting value returned by memory allocation function to (struct hv_pcibus_device *) is useless.
@ 2019-12-03  7:34 kbuild test robot
  2019-12-03  7:34   ` kbuild test robot
  0 siblings, 1 reply; 3+ messages in thread
From: kbuild test robot @ 2019-12-03  7:34 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 795 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   1ab75b2e415a29dba9aec94f203c6f88dbfc0ba0
commit: 877b911a5ba0733f62239055ee869f2e117b57da [13591/14582] PCI: hv: Avoid a kmemleak false positive caused by the hbus buffer

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>


coccinelle warnings: (new ones prefixed by >>)

>> drivers/pci/controller/pci-hyperv.c:2925:9-32: WARNING: casting value returned by memory allocation function to (struct hv_pcibus_device *) is useless.

Please review and possibly fold the followup patch.

---
0-DAY kernel test infrastructure                 Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org Intel Corporation

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] PCI: hv: fix alloc_cast.cocci warnings
@ 2019-12-03  7:34   ` kbuild test robot
  0 siblings, 0 replies; 3+ messages in thread
From: kbuild test robot @ 2019-12-03  7:34 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 1721 bytes --]

From: kbuild test robot <lkp@intel.com>

drivers/pci/controller/pci-hyperv.c:2925:9-32: WARNING: casting value returned by memory allocation function to (struct hv_pcibus_device *) is useless.

 Remove casting the values returned by memory allocation functions
 like kmalloc, kzalloc, kmem_cache_alloc, kmem_cache_zalloc etc.

Semantic patch information:
 This makes an effort to find cases of casting of values returned by
 kmalloc, kzalloc, kcalloc, kmem_cache_alloc, kmem_cache_zalloc,
 kmem_cache_alloc_node, kmalloc_node and kzalloc_node and removes
 the casting as it is not required. The result in the patch case may
 need some reformatting.

Generated by: scripts/coccinelle/api/alloc/alloc_cast.cocci

Fixes: 877b911a5ba0 ("PCI: hv: Avoid a kmemleak false positive caused by the hbus buffer")
CC: Dexuan Cui <decui@microsoft.com>
Signed-off-by: kbuild test robot <lkp@intel.com>
---

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   1ab75b2e415a29dba9aec94f203c6f88dbfc0ba0
commit: 877b911a5ba0733f62239055ee869f2e117b57da [13591/14582] PCI: hv: Avoid a kmemleak false positive caused by the hbus buffer

 pci-hyperv.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- 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
 	 * 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;

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-12-03  7:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-03  7:34 [linux-next:master 13591/14582] drivers/pci/controller/pci-hyperv.c:2925:9-32: WARNING: casting value returned by memory allocation function to (struct hv_pcibus_device *) is useless kbuild test robot
2019-12-03  7:34 ` [PATCH] PCI: hv: fix alloc_cast.cocci warnings kbuild test robot
2019-12-03  7:34   ` kbuild test robot

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.