[dpdk-dev] mmap(2) returns MAP_FAILED, not NULL, on failure

Message ID 24F37CB2-A34A-472D-88DF-3E27E0E98F78@mykolab.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/Intel-compilation fail apply patch file failure

Commit Message

Michael McConville Dec. 1, 2017, 6:51 a.m. UTC
  Signed-off-by: Michael McConville <mmcco@mykolab.com>
---
lib/librte_eal/bsdapp/eal/eal_memory.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Ferruh Yigit Dec. 2, 2017, 12:50 a.m. UTC | #1
On 11/30/2017 10:51 PM, Michael McConville wrote:
> Signed-off-by: Michael McConville <mmcco@mykolab.com>

Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>


Hi Michael,

Thanks you for the patch, can you please check the contribution guide [1] for
expected patch format for next patches.

[1]
http://dpdk.org/doc/guides/contributing/patches.html

<...>
  
Ferruh Yigit Dec. 2, 2017, 12:51 a.m. UTC | #2
On 12/1/2017 4:50 PM, Ferruh Yigit wrote:
> On 11/30/2017 10:51 PM, Michael McConville wrote:
>> Signed-off-by: Michael McConville <mmcco@mykolab.com>
> 
> Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
> 
> 
> Hi Michael,
> 
> Thanks you for the patch, can you please check the contribution guide [1] for
> expected patch format for next patches.

Ahh, there is checkpatch warning as well, can you make a new version of the
patch with updated patch title and warning fixed?

> 
> [1]
> http://dpdk.org/doc/guides/contributing/patches.html
> 
> <...>
>
  
Ferruh Yigit Dec. 2, 2017, 12:54 a.m. UTC | #3
On 11/30/2017 10:51 PM, Michael McConville wrote:
> Signed-off-by: Michael McConville <mmcco@mykolab.com>
> ---
> lib/librte_eal/bsdapp/eal/eal_memory.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/librte_eal/bsdapp/eal/eal_memory.c b/lib/librte_eal/bsdapp/eal/eal_memory.c
> index 6ba058578..2c8a4b592 100644
> --- a/lib/librte_eal/bsdapp/eal/eal_memory.c
> +++ b/lib/librte_eal/bsdapp/eal/eal_memory.c
> @@ -155,7 +155,7 @@ rte_eal_hugepage_attach(void)
>        /* Map the shared hugepage_info into the process address spaces */
>        hpi = mmap(NULL, sizeof(struct hugepage_info), PROT_READ, MAP_PRIVATE,
>                        fd_hugepage_info, 0);
> -       if (hpi == NULL) {
> +       if (hpi == MAP_FAILED) {

Hi Matej,

Can you fix same thing in szedata2 PMD please [1] ?

[1]
http://dpdk.org/browse/dpdk/tree/drivers/net/szedata2/rte_eth_szedata2.c?h=v17.11#n1556

>                RTE_LOG(ERR, EAL, "Could not mmap %s\n", eal_hugepage_info_path());
>                goto error;
>        }
>
  
Matej Vido Dec. 4, 2017, 7:32 a.m. UTC | #4
On 02.12.2017 01:54, Ferruh Yigit wrote:
> On 11/30/2017 10:51 PM, Michael McConville wrote:
>> Signed-off-by: Michael McConville <mmcco@mykolab.com>
>> ---
>> lib/librte_eal/bsdapp/eal/eal_memory.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/lib/librte_eal/bsdapp/eal/eal_memory.c b/lib/librte_eal/bsdapp/eal/eal_memory.c
>> index 6ba058578..2c8a4b592 100644
>> --- a/lib/librte_eal/bsdapp/eal/eal_memory.c
>> +++ b/lib/librte_eal/bsdapp/eal/eal_memory.c
>> @@ -155,7 +155,7 @@ rte_eal_hugepage_attach(void)
>>         /* Map the shared hugepage_info into the process address spaces */
>>         hpi = mmap(NULL, sizeof(struct hugepage_info), PROT_READ, MAP_PRIVATE,
>>                         fd_hugepage_info, 0);
>> -       if (hpi == NULL) {
>> +       if (hpi == MAP_FAILED) {
> Hi Matej,
>
> Can you fix same thing in szedata2 PMD please [1] ?
>
> [1]
> http://dpdk.org/browse/dpdk/tree/drivers/net/szedata2/rte_eth_szedata2.c?h=v17.11#n1556

Hi Ferruh,

I will send a patch.

Thanks,
Matej
>
>>                 RTE_LOG(ERR, EAL, "Could not mmap %s\n", eal_hugepage_info_path());
>>                 goto error;
>>         }
>>
  
Thomas Monjalon Jan. 9, 2018, 4:03 p.m. UTC | #5
02/12/2017 01:51, Ferruh Yigit:
> On 12/1/2017 4:50 PM, Ferruh Yigit wrote:
> > On 11/30/2017 10:51 PM, Michael McConville wrote:
> >> Signed-off-by: Michael McConville <mmcco@mykolab.com>
> > 
> > Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
> > 
> > 
> > Hi Michael,
> > 
> > Thanks you for the patch, can you please check the contribution guide [1] for
> > expected patch format for next patches.
> 
> Ahh, there is checkpatch warning as well, can you make a new version of the
> patch with updated patch title and warning fixed?

Fixed and applied, thanks
  

Patch

diff --git a/lib/librte_eal/bsdapp/eal/eal_memory.c b/lib/librte_eal/bsdapp/eal/eal_memory.c
index 6ba058578..2c8a4b592 100644
--- a/lib/librte_eal/bsdapp/eal/eal_memory.c
+++ b/lib/librte_eal/bsdapp/eal/eal_memory.c
@@ -155,7 +155,7 @@  rte_eal_hugepage_attach(void)
       /* Map the shared hugepage_info into the process address spaces */
       hpi = mmap(NULL, sizeof(struct hugepage_info), PROT_READ, MAP_PRIVATE,
                       fd_hugepage_info, 0);
-       if (hpi == NULL) {
+       if (hpi == MAP_FAILED) {
               RTE_LOG(ERR, EAL, "Could not mmap %s\n", eal_hugepage_info_path());
               goto error;
       }