On Thu, 28 May 2020 09:31:54 +0200
Thomas Monjalon <tho...@monjalon.net> wrote:

> 25/05/2020 02:37, Dmitry Kozlyuk:
> > All supported OS create memory segment lists (MSL) and reserve VA space
> > for them in a nearly identical way. Move common code into EAL private
> > functions to reduce duplication.
> > 
> > Signed-off-by: Dmitry Kozlyuk <dmitry.kozl...@gmail.com>
> > ---
> > +void
> > +eal_memseg_list_populate(struct rte_memseg_list *msl, void *addr, int 
> > n_segs)
> > +{
> > +   uint64_t page_sz = msl->page_sz;  
> [...]
> > +           addr = RTE_PTR_ADD(addr, page_sz);  
> 
> This is an error in 32-bit compilation:
> 
> lib/librte_eal/common/eal_common_memory.c:
> In function ‘eal_memseg_list_populate’: rte_common.h:215:30: error:
> cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
>   215 | #define RTE_PTR_ADD(ptr, x) ((void*)((uintptr_t)(ptr) + (x)))
>       |                              ^
> 
> The original code was doing a cast to size_t.
> 
> > --- a/lib/librte_eal/linux/eal_memory.c
> > +++ b/lib/librte_eal/linux/eal_memory.c
> > -                   addr = RTE_PTR_ADD(addr, (size_t)page_sz);  
> 
> I believe the correct cast should be uintptr_t.
> Maybe it would be even more correct to do this cast inside RTE_PTR_ADD?

Ack, this is the issue I mentioned in the Community Call letter. I think
size_t is a more suitable type for page_*sz* than uintptr_t.

-- 
Dmitry Kozlyuk

Reply via email to