From: Abhijit Gangurde <abhijit.gangurde@amd.com>
To: <Nipun.Gupta@amd.com>, <nikhil.agarwal@amd.com>
Cc: <dev@dpdk.org>, <david.marchand@redhat.com>,
<ferruh.yigit@amd.com>,
Abhijit Gangurde <abhijit.gangurde@amd.com>
Subject: [PATCH] bus/cdx: Move debug print before unmapping resource
Date: Wed, 14 Jun 2023 15:53:14 +0530 [thread overview]
Message-ID: <20230614102314.224579-1-abhijit.gangurde@amd.com> (raw)
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
next reply other threads:[~2023-06-14 10:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-14 10:23 Abhijit Gangurde [this message]
2023-06-15 10:58 ` Nipun Gupta
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230614102314.224579-1-abhijit.gangurde@amd.com \
--to=abhijit.gangurde@amd.com \
--cc=Nipun.Gupta@amd.com \
--cc=david.marchand@redhat.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@amd.com \
--cc=nikhil.agarwal@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).