diff mbox series

[dpdk-dev,7/7] net/avp: fix 32-bit meson builds

Message ID 20180608163807.66737-8-bruce.richardson@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers show
Series Enable 32-bit native builds with meson | expand

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Bruce Richardson June 8, 2018, 4:38 p.m. UTC
When compiling with meson, extra warnings are enabled about casting from
integers to different size pointers. This triggers an error in AVP as the
addition of the offset to the pointer address causes the result to be a
64-bit integer which doesn't fit a 32-bit pointer. The fix here is to
explicitly indicate that the offset is of type "uintptr_t" which prevents
any promotion which would cause errors.

Fixes: c0ad584222b5 ("net/avp: add device initialization")

Cc: allain.legacy@windriver.com
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 drivers/net/avp/avp_ethdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Allain Legacy June 8, 2018, 4:58 p.m. UTC | #1
> -----Original Message-----
> From: Bruce Richardson [mailto:bruce.richardson@intel.com]
> Sent: Friday, June 08, 2018 12:38 PM
> To: dev@dpdk.org
> Cc: RICHARDSON, BRUCE; Legacy, Allain
> Subject: [PATCH 7/7] net/avp: fix 32-bit meson builds
> 
> When compiling with meson, extra warnings are enabled about casting from
> integers to different size pointers. This triggers an error in AVP as the
> addition of the offset to the pointer address causes the result to be a 64-bit
> integer which doesn't fit a 32-bit pointer. The fix here is to explicitly indicate
> that the offset is of type "uintptr_t" which prevents any promotion which
> would cause errors.
> 
> Fixes: c0ad584222b5 ("net/avp: add device initialization")
> 
> Cc: allain.legacy@windriver.com
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>

Acked-by:  Allain Legacy <allain.legacy@windriver.com>
diff mbox series

Patch

diff --git a/drivers/net/avp/avp_ethdev.c b/drivers/net/avp/avp_ethdev.c
index dc97e60e6..5e859c8dd 100644
--- a/drivers/net/avp/avp_ethdev.c
+++ b/drivers/net/avp/avp_ethdev.c
@@ -383,7 +383,7 @@  avp_dev_translate_address(struct rte_eth_dev *eth_dev,
 			(host_phys_addr < (map->phys_addr + map->length))) {
 			/* address is within this segment */
 			offset += (host_phys_addr - map->phys_addr);
-			addr = RTE_PTR_ADD(addr, offset);
+			addr = RTE_PTR_ADD(addr, (uintptr_t)offset);
 
 			PMD_DRV_LOG(DEBUG, "Translating host physical 0x%" PRIx64 " to guest virtual 0x%p\n",
 				    host_phys_addr, addr);