Re: [PATCH v2 1/4] powerpc/4xx: Fix exception handling in ppc4xx_pciex_port_setup_hose()

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

 





Le 25/03/2023 à 16:36, Markus Elfring a écrit :
Date: Thu, 16 Mar 2023 19:00:57 +0100

The label “fail” was used to jump to another pointer check despite of
the detail in the implementation of the function “ppc4xx_pciex_port_setup_hose”
that it was determined already that the corresponding variable contained
a null pointer (because of a failed function call in three cases).

1. Thus return directly after a call of the function “pcibios_alloc_controller” failed.

2. Use more appropriate labels instead.

3. Reorder jump targets at the end.

4. Delete two questionable checks.


This issue was detected by using the Coccinelle software.

Fixes: a2d2e1ec07a80946cbe812dc8c73291cad8214b2 ("[POWERPC] 4xx: PLB to PCI Express support")
Fixes: 80daac3f86d4f5aafc9d3e79addb90fa118244e2 ("[POWERPC] 4xx: Add endpoint support to 4xx PCIe driver")
Signed-off-by: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>

Looks like you have messed up your patches, there is no much we can do it seems:

$ b4 shazam e68a714b-32f2-de9f-066e-99a3f51a264f@xxxxxx

$ LANG= b4 --no-stdin shazam e68a714b-32f2-de9f-066e-99a3f51a264f@xxxxxx
Grabbing thread from lore.kernel.org/all/e68a714b-32f2-de9f-066e-99a3f51a264f@xxxxxx/t.mbox.gz
Checking for newer revisions
Grabbing search results from lore.kernel.org
Analyzing 123 messages in the thread
WARNING: duplicate messages found at index 1
   Subject 1: btrfs: Fix exception handling in relocating_repair_kthread()
Subject 2: powerpc/4xx: Fix exception handling in ppc4xx_pciex_port_setup_hose()
  2 is not a reply... assume additional patch
Assuming new revision: v3 ([cocci] [PATCH] ufs: Fix exception handling in ufs_fill_super()) Assuming new revision: v4 ([cocci] [PATCH] perf cputopo: Improve exception handling in build_cpu_topology()) Assuming new revision: v5 ([cocci] [PATCH] perf pmu: Improve exception handling in pmu_lookup()) Assuming new revision: v6 ([cocci] [PATCH] selftests/bpf: Improve exception handling in rbtree_add_and_remove()) Assuming new revision: v7 ([cocci] [PATCH resent] btrfs: Fix exception handling in relocating_repair_kthread()) Assuming new revision: v8 ([cocci] [PATCH resent] ufs: Fix exception handling in ufs_fill_super()) Assuming new revision: v9 ([cocci] [PATCH resent] perf cputopo: Improve exception handling in build_cpu_topology())
WARNING: duplicate messages found at index 1
Subject 1: scsi: message: fusion: Return directly after input data validation failed in four functions
   Subject 2: btrfs: Fix exception handling in relocating_repair_kthread()
2 is a reply... replacing existing: btrfs: Fix exception handling in relocating_repair_kthread()
WARNING: duplicate messages found at index 2
Subject 1: scsi: message: fusion: Delete a redundant pointer check in four functions Subject 2: powerpc/4xx: Fix exception handling in ppc4xx_pciex_port_setup_hose()
  2 is not a reply... assume additional patch
WARNING: duplicate messages found at index 3
Subject 1: scsi: message: fusion: Delete an unnecessary variable initialisation in four functions Subject 2: powerpc/4xx: Fix exception handling in ppc4xx_pciex_port_setup_hose()
  2 is not a reply... assume additional patch
WARNING: duplicate messages found at index 1
   Subject 1: md/raid1: Fix exception handling in setup_conf()
Subject 2: scsi: message: fusion: Return directly after input data validation failed in four functions
  2 is not a reply... assume additional patch
WARNING: duplicate messages found at index 2
   Subject 1: md/raid10: Fix exception handling in setup_conf()
Subject 2: scsi: message: fusion: Return directly after input data validation failed in four functions
  2 is not a reply... assume additional patch
WARNING: duplicate messages found at index 1
Subject 1: irqchip/gic-v4: Fix exception handling in its_alloc_vcpu_irqs()
   Subject 2: md/raid1: Fix exception handling in setup_conf()
  2 is not a reply... assume additional patch
WARNING: duplicate messages found at index 2
Subject 1: irqchip/gic-v4: Fix exception handling in its_alloc_vcpu_sgis()
   Subject 2: md/raid1: Fix exception handling in setup_conf()
  2 is not a reply... assume additional patch
WARNING: duplicate messages found at index 1
   Subject 1: selinux: Improve exception handling in security_get_bools()
Subject 2: irqchip/gic-v4: Fix exception handling in its_alloc_vcpu_irqs()
  2 is not a reply... assume additional patch
WARNING: duplicate messages found at index 1
   Subject 1: selinux: Adjust implementation of security_get_bools()
Subject 2: powerpc/4xx: Fix exception handling in ppc4xx_pciex_port_setup_hose()
  2 is not a reply... assume additional patch
WARNING: duplicate messages found at index 1
   Subject 1: IB/uverbs: Improve exception handling in create_qp()
   Subject 2: selinux: Improve exception handling in security_get_bools()
2 is a reply... replacing existing: selinux: Improve exception handling in security_get_bools()
WARNING: duplicate messages found at index 2
   Subject 1: IB/uverbs: Delete a duplicate check in create_qp()
Subject 2: irqchip/gic-v4: Fix exception handling in its_alloc_vcpu_irqs()
  2 is not a reply... assume additional patch
WARNING: duplicate messages found at index 1
Subject 1: powerpc/pseries: Fix exception handling in pSeries_reconfig_add_node()
   Subject 2: IB/uverbs: Improve exception handling in create_qp()
  2 is not a reply... assume additional patch
Assuming new revision: v10 ([PATCH] ipvs: Fix exception handling in two functions) Assuming new revision: v11 ([PATCH] selftests: cgroup: Fix exception handling in test_memcg_oom_group_score_events()) Assuming new revision: v12 ([Nouveau] [PATCH] drm/nouveau: Add a jump label in nouveau_gem_ioctl_pushbuf()) Assuming new revision: v13 ([PATCH] mm/mempolicy: Fix exception handling in shared_policy_replace()) Assuming new revision: v14 ([PATCH] firmware: ti_sci: Fix exception handling in ti_sci_probe()) Assuming new revision: v15 ([PATCH] remoteproc: imx_dsp_rproc: Improve exception handling in imx_dsp_rproc_mbox_alloc()) Assuming new revision: v16 ([PATCH] spi: atmel: Improve exception handling in atmel_spi_configure_dma())
WARNING: duplicate messages found at index 1
Subject 1: powerpc/pseries: Do not pass an error pointer to of_node_put() in pSeries_reconfig_add_node()
   Subject 2: selinux: Adjust implementation of security_get_bools()
2 is a reply... replacing existing: selinux: Adjust implementation of security_get_bools()
WARNING: duplicate messages found at index 2
Subject 1: powerpc/pseries: Fix exception handling in pSeries_reconfig_add_node() Subject 2: powerpc/4xx: Fix exception handling in ppc4xx_pciex_port_setup_hose()
  2 is not a reply... assume additional patch
WARNING: duplicate messages found at index 1
Subject 1: powerpc/pseries: Do not pass an error pointer to of_node_put() in pSeries_reconfig_add_node() Subject 2: powerpc/pseries: Do not pass an error pointer to of_node_put() in pSeries_reconfig_add_node()
  2 is not a reply... assume additional patch
WARNING: duplicate messages found at index 2
Subject 1: powerpc/pseries: Fix exception handling in pSeries_reconfig_add_node() Subject 2: powerpc/pseries: Do not pass an error pointer to of_node_put() in pSeries_reconfig_add_node()
  2 is not a reply... assume additional patch
Will use the latest revision: v16
You can pick other revisions using the -vN flag
Checking attestation on all messages, may take a moment...
---
✗ [PATCH] spi: atmel: Improve exception handling in atmel_spi_configure_dma()
  ---
  ✗ BADSIG: DKIM/web.de
  ✓ Signed: DKIM/lists.infradead.org (From: Markus.Elfring@xxxxxx)
---
Total patches: 1
---
Applying: spi: atmel: Improve exception handling in atmel_spi_configure_dma()



---
  arch/powerpc/platforms/4xx/pci.c | 19 ++++++++++---------
  1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/arch/powerpc/platforms/4xx/pci.c b/arch/powerpc/platforms/4xx/pci.c
index ca5dd7a5842a..7336c7039b10 100644
--- a/arch/powerpc/platforms/4xx/pci.c
+++ b/arch/powerpc/platforms/4xx/pci.c
@@ -1930,7 +1930,7 @@ static void __init ppc4xx_pciex_port_setup_hose(struct ppc4xx_pciex_port *port)
  	/* Allocate the host controller data structure */
  	hose = pcibios_alloc_controller(port->node);
  	if (!hose)
-		goto fail;
+		return;

  	/* We stick the port number in "indirect_type" so the config space
  	 * ops can retrieve the port data structure easily
@@ -1962,7 +1962,7 @@ static void __init ppc4xx_pciex_port_setup_hose(struct ppc4xx_pciex_port *port)
  		if (cfg_data == NULL) {
  			printk(KERN_ERR "%pOF: Can't map external config space !",
  			       port->node);
-			goto fail;
+			goto free_controller;
  		}
  		hose->cfg_data = cfg_data;
  	}
@@ -1974,7 +1974,7 @@ static void __init ppc4xx_pciex_port_setup_hose(struct ppc4xx_pciex_port *port)
  	if (mbase == NULL) {
  		printk(KERN_ERR "%pOF: Can't map internal config space !",
  		       port->node);
-		goto fail;
+		goto recheck_cfg_data;
  	}
  	hose->cfg_addr = mbase;

@@ -2007,7 +2007,7 @@ static void __init ppc4xx_pciex_port_setup_hose(struct ppc4xx_pciex_port *port)

  	/* Parse inbound mapping resources */
  	if (ppc4xx_parse_dma_ranges(hose, mbase, &dma_window) != 0)
-		goto fail;
+		goto unmap_io_mbase;

  	/* Configure outbound ranges POMs */
  	ppc4xx_configure_pciex_POMs(port, hose, mbase);
@@ -2064,13 +2064,14 @@ static void __init ppc4xx_pciex_port_setup_hose(struct ppc4xx_pciex_port *port)
  	}

  	return;
- fail:
-	if (hose)
-		pcibios_free_controller(hose);
+
+unmap_io_mbase:
+	iounmap(mbase);
+recheck_cfg_data:
  	if (cfg_data)
  		iounmap(cfg_data);
-	if (mbase)
-		iounmap(mbase);
+free_controller:
+	pcibios_free_controller(hose);
  }

  static void __init ppc4xx_probe_pciex_bridge(struct device_node *np)
--
2.40.0





[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux