summaryrefslogtreecommitdiffstats
path: root/src/vppinfra/pool.h
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2023-11-06 17:37:04 +0000
committerDamjan Marion <damarion@cisco.com>2023-11-06 17:40:07 +0000
commite73c731ad8890d1b64c55e3e9dfb9fc8529624f9 (patch)
treed446d4e893a75b9f44ce4c0e3279456e54561167 /src/vppinfra/pool.h
parent4504df795b0ffc4863b12b0d97786423d8b63562 (diff)
vppinfra: fix ASAN issue in vec_foreach_pointer and pool_foreach_pointer
Change-Id: If9381ae7283488b352a3c22f85732cd56ac6bfd9 Type: fix Fixes: 9937359, 91ff0e9 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vppinfra/pool.h')
-rw-r--r--src/vppinfra/pool.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/vppinfra/pool.h b/src/vppinfra/pool.h
index 99138386fe6..1a414aef65f 100644
--- a/src/vppinfra/pool.h
+++ b/src/vppinfra/pool.h
@@ -571,9 +571,10 @@ do { \
/* works only for pool of pointers, e is declared inside macro */
#define pool_foreach_pointer(e, p) \
if (p) \
- for (typeof ((p)[0]) *_t = (p) + pool_get_first_index (p), (e) = *_t; \
- _t < vec_end (p); \
- _t = (p) + pool_get_next_index (p, _t - (p)), (e) = *_t)
+ for (typeof ((p)[0]) *_t = (p) + pool_get_first_index (p), (e) = *_t, \
+ *_end = vec_end (p); \
+ _t < _end; _t = (p) + pool_get_next_index (p, _t - (p)), \
+ (e) = _t < _end ? *_t : (e))
/**
* @brief Remove all elements from a pool in a safe way