mem: fix build of virtual address hinting for 32-bit
authorDavid Marchand <david.marchand@6wind.com>
Fri, 28 Feb 2014 08:21:35 +0000 (09:21 +0100)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Thu, 20 Mar 2014 14:34:46 +0000 (15:34 +0100)
The initial commit doesn't build for 32-bit:
8ea9ff83 (mem: allow virtual memory address hinting)

lib/librte_eal/linuxapp/eal/eal.c: In function â€˜eal_parse_base_virtaddr’:
build/include/rte_common.h:133:22:
error: cast from pointer to integer of different size
[-Werror=pointer-to-int-cast]
  RTE_PTR_ALIGN_FLOOR((typeof(ptr))RTE_PTR_ADD(ptr, (align) - 1), align)
                      ^

RTE_PTR_ALIGN_CEIL return type is the same as what we give it as input.
So instead of casting the returned value, cast 'addr' which should be the same
as base_virtaddr.

Reported-by: Mats Liljegren <mats.liljegren@enea.com>
Signed-off-by: David Marchand <david.marchand@6wind.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
lib/librte_eal/linuxapp/eal/eal.c

index db0e15c..72b4dd7 100644 (file)
@@ -563,9 +563,9 @@ eal_parse_base_virtaddr(const char *arg)
 #endif
 
        /* align the addr on 2M boundary */
-       addr = RTE_PTR_ALIGN_CEIL(addr, RTE_PGSIZE_2M);
+       internal_config.base_virtaddr = RTE_PTR_ALIGN_CEIL((uintptr_t)addr,
+                                                          RTE_PGSIZE_2M);
 
-       internal_config.base_virtaddr = (uintptr_t) addr;
        return 0;
 }