bus/cdx: Move debug print before unmapping resource

Message ID 20230614102314.224579-1-abhijit.gangurde@amd.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series bus/cdx: Move debug print before unmapping resource |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/github-robot: build success github build: passed
ci/intel-Functional success Functional PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-unit-testing success Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-aarch-unit-testing success Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS

Commit Message

Abhijit Gangurde June 14, 2023, 10:23 a.m. UTC
  Debug print is moved before unmapping requested address
to fix use after free coverity issue.

Coverity issue: 385381
Fixes: 45ef232af515 ("bus/cdx: introduce AMD CDX bus")
Signed-off-by: Abhijit Gangurde <abhijit.gangurde@amd.com>
---
 drivers/bus/cdx/cdx.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
  

Comments

Gupta, Nipun June 15, 2023, 10:58 a.m. UTC | #1
Please do not use first letter of the commit as capital ("Move" should 
be "move"). Also fix this for other patches sent for CDX.

check-git-log.sh script report these errors. Please run this before sending.

On 6/14/2023 3:53 PM, Abhijit Gangurde wrote:
> Debug print is moved before unmapping requested address
> to fix use after free coverity issue.
> 
> Coverity issue: 385381
> Fixes: 45ef232af515 ("bus/cdx: introduce AMD CDX bus")
> Signed-off-by: Abhijit Gangurde <abhijit.gangurde@amd.com>
> ---
>   drivers/bus/cdx/cdx.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
  

Patch

diff --git a/drivers/bus/cdx/cdx.c b/drivers/bus/cdx/cdx.c
index 28bbf92ed5..85353d8996 100644
--- a/drivers/bus/cdx/cdx.c
+++ b/drivers/bus/cdx/cdx.c
@@ -322,12 +322,13 @@  cdx_unmap_resource(void *requested_addr, size_t size)
 	if (requested_addr == NULL)
 		return;
 
+	CDX_BUS_DEBUG("Unmapping CDX memory at %p", requested_addr);
+
 	/* Unmap the CDX memory resource of device */
 	if (rte_mem_unmap(requested_addr, size)) {
 		CDX_BUS_ERR("%s(): cannot mem unmap(%p, %#zx): %s", __func__,
 			requested_addr, size, rte_strerror(rte_errno));
 	}
-	CDX_BUS_DEBUG("CDX memory unmapped at %p", requested_addr);
 }
 /*
  * Match the CDX Driver and Device using device id and vendor id.