[v1,2/2] linux-gen: pool: pool_t.base_addr offset has to be 64-bit

Message ID 1519113607-26653-3-git-send-email-odpbot@yandex.ru
State New
Headers show
Series
  • Fix creating pools larger than 4.29GB
Related show

Commit Message

Github ODP bot Feb. 20, 2018, 8 a.m.
From: Matias Elo <matias.elo@nokia.com>


Enables using pools larger than UINT32_MAX.

Fixes: https://bugs.linaro.org/show_bug.cgi?id=3632

Signed-off-by: Matias Elo <matias.elo@nokia.com>

---
/** Email created from pull request 490 (matiaselo:fix/pool_create)
 ** https://github.com/Linaro/odp/pull/490
 ** Patch: https://github.com/Linaro/odp/pull/490.patch
 ** Base sha: d5419e8857b2bc61d3be17fe53f171550fee426b
 ** Merge commit sha: ad05fc232e7d91885e16f718adc44c77eef01988
 **/
 platform/linux-generic/odp_pool.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Patch

diff --git a/platform/linux-generic/odp_pool.c b/platform/linux-generic/odp_pool.c
index 357595317..1bd41e516 100644
--- a/platform/linux-generic/odp_pool.c
+++ b/platform/linux-generic/odp_pool.c
@@ -83,10 +83,10 @@  static inline pool_t *pool_from_buf(odp_buffer_t buf)
 static inline odp_buffer_hdr_t *buf_hdr_from_index(pool_t *pool,
 						   uint32_t buffer_idx)
 {
-	uint32_t block_offset;
+	uint64_t block_offset;
 	odp_buffer_hdr_t *buf_hdr;
 
-	block_offset = buffer_idx * pool->block_size;
+	block_offset = buffer_idx * (uint64_t)pool->block_size;
 
 	/* clang requires cast to uintptr_t */
 	buf_hdr = (odp_buffer_hdr_t *)(uintptr_t)&pool->base_addr[block_offset];
@@ -236,7 +236,7 @@  static pool_t *reserve_pool(void)
 
 static void init_buffers(pool_t *pool)
 {
-	uint32_t i;
+	uint64_t i;
 	odp_buffer_hdr_t *buf_hdr;
 	odp_packet_hdr_t *pkt_hdr;
 	odp_shm_info_t shm_info;