From: "Huang, Wei" <wei.huang@intel.com>
To: Chengwen Feng <fengchengwen@huawei.com>,
"thomas@monjalon.net" <thomas@monjalon.net>,
"ferruh.yigit@amd.com" <ferruh.yigit@amd.com>,
"Xu, Rosen" <rosen.xu@intel.com>,
"Zhang, Tianfei" <tianfei.zhang@intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>
Subject: RE: [PATCH 2/2] raw/ifpga/base: fix mmap retcode check fail
Date: Tue, 7 Feb 2023 01:11:08 +0000 [thread overview]
Message-ID: <DM6PR11MB3530026B5905CA835080A374EFDB9@DM6PR11MB3530.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20230206105311.9577-3-fengchengwen@huawei.com>
It looks good.
> -----Original Message-----
> From: Chengwen Feng <fengchengwen@huawei.com>
> Sent: Monday, February 6, 2023 18:53
> To: thomas@monjalon.net; ferruh.yigit@amd.com; Xu, Rosen
> <rosen.xu@intel.com>; Zhang, Tianfei <tianfei.zhang@intel.com>; Huang,
> Wei <wei.huang@intel.com>
> Cc: dev@dpdk.org
> Subject: [PATCH 2/2] raw/ifpga/base: fix mmap retcode check fail
>
> The MAP_FAILED should be used to determine whether the mapping is
> successful.
>
> Fixes: e41856b515ce ("raw/ifpga/base: enhance driver reliability in multi-
> process")
> Cc: stable@dpdk.org
>
> Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
> ---
> drivers/raw/ifpga/base/opae_hw_api.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/raw/ifpga/base/opae_hw_api.c
> b/drivers/raw/ifpga/base/opae_hw_api.c
> index 1117c3e160..6d48d227d6 100644
> --- a/drivers/raw/ifpga/base/opae_hw_api.c
> +++ b/drivers/raw/ifpga/base/opae_hw_api.c
> @@ -380,7 +380,7 @@ static pthread_mutex_t
> *opae_adapter_mutex_open(struct opae_adapter *adapter)
> PROT_READ | PROT_WRITE, MAP_SHARED,
> shm_id, 0);
> adapter->lock = (pthread_mutex_t *)ptr;
> - if (ptr) {
> + if (ptr != MAP_FAILED) {
> dev_info(NULL,
> "shared memory %s address is %p\n",
> shm_name, ptr);
> @@ -499,7 +499,7 @@ static void *opae_adapter_shm_alloc(struct
> opae_adapter *adapter)
> adapter->shm.size = size;
> adapter->shm.ptr = mmap(NULL, size, PROT_READ |
> PROT_WRITE,
> MAP_SHARED,
> shm_id, 0);
> - if (adapter->shm.ptr) {
> + if (adapter->shm.ptr != MAP_FAILED) {
> dev_info(NULL,
> "shared memory %s address is %p\n",
> shm_name, adapter->shm.ptr);
> --
> 2.17.1
next prev parent reply other threads:[~2023-02-07 1:11 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-06 10:53 [PATCH 0/2] " Chengwen Feng
2023-02-06 10:53 ` [PATCH 1/2] eal: fix mmap fail regarded as success Chengwen Feng
2023-02-09 9:04 ` David Marchand
2023-02-06 10:53 ` [PATCH 2/2] raw/ifpga/base: fix mmap retcode check fail Chengwen Feng
2023-02-07 1:11 ` Huang, Wei [this message]
2023-02-07 7:16 ` Xu, Rosen
2023-02-09 9:04 ` [PATCH 0/2] " David Marchand
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=DM6PR11MB3530026B5905CA835080A374EFDB9@DM6PR11MB3530.namprd11.prod.outlook.com \
--to=wei.huang@intel.com \
--cc=dev@dpdk.org \
--cc=fengchengwen@huawei.com \
--cc=ferruh.yigit@amd.com \
--cc=rosen.xu@intel.com \
--cc=thomas@monjalon.net \
--cc=tianfei.zhang@intel.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).