[dpdk-dev] [PATCH v2] vfio: Fix overflow while assigning vfio BAR region offset and size

Rahul Lakkireddy rahul.lakkireddy at chelsio.com
Tue Jul 7 12:40:38 CEST 2015


Hi Anatoly,

On Tue, Jul 07, 2015 at 09:08:08 +0000, Burakov, Anatoly wrote:
> Hi all,
> 
> > So, as VFIO support for 32bit systems is broken, DPDK should not configure VFIO in that case.
> 
> ...Or no one should try and run VFIO on a 32-bit system, which should be noted in documentation. I'm a bit wary of adding special handling in this case.
> 
> Does making the offset off_t fix the compile issues for 32 bit kernel?
> 

Making offset off_t seems to fail for x86_x32-native-linuxapp-gcc target with
the following error in 64-bit gcc, but is working fine with i686 and
x86_64 targets:

/home/ubuntu/dpdk/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c: In function ‘pci_vfio_map_resource’:
/home/ubuntu/dpdk/x86_x32-native-linuxapp-gcc/include/rte_common.h:90:30: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
 #define RTE_PTR_ADD(ptr, x) ((void*)((uintptr_t)(ptr) + (x)))
                              ^
/home/ubuntu/dpdk/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c:816:25: note: in expansion of macro ‘RTE_PTR_ADD’
     void *second_addr = RTE_PTR_ADD(bar_addr, memreg[1].offset);
                         ^
cc1: all warnings being treated as errors
make[7]: *** [eal_pci_vfio.o] Error 1
make[6]: *** [eal] Error 2
make[5]: *** [linuxapp] Error 2
make[4]: *** [librte_eal] Error 2
make[3]: *** [lib] Error 2
make[2]: *** [all] Error 2
make[1]: *** [x86_x32-native-linuxapp-gcc_install] Error 2
make: *** [install] Error 2

However, unsigned long seems to be working fine for all builds.

Thanks,
Rahul


More information about the dev mailing list