DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] bus/cdx: Move debug print before unmapping resource
@ 2023-06-14 10:23 Abhijit Gangurde
  2023-06-15 10:58 ` Nipun Gupta
  0 siblings, 1 reply; 2+ messages in thread
From: Abhijit Gangurde @ 2023-06-14 10:23 UTC (permalink / raw)
  To: Nipun.Gupta, nikhil.agarwal
  Cc: dev, david.marchand, ferruh.yigit, Abhijit Gangurde

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(-)

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.
-- 
2.25.1


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

end of thread, other threads:[~2023-06-15 10:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-14 10:23 [PATCH] bus/cdx: Move debug print before unmapping resource Abhijit Gangurde
2023-06-15 10:58 ` Nipun Gupta

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).