Skip to content

Commit 736f56e

Browse files
committed
chore: fix wrong fd_pool acquire usage
calling acquire on a pool with no space left is UB and cannot be assumed to return NULL
1 parent 1c898b7 commit 736f56e

File tree

6 files changed

+0
-12
lines changed

6 files changed

+0
-12
lines changed

src/discof/forest/fd_forest.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,6 @@ fd_forest_init( fd_forest_t * forest, ulong root_slot ) {
175175

176176
/* Sanity checks. */
177177

178-
FD_TEST( root_ele );
179178
FD_TEST( root_ele == fd_forest_frontier_ele_query( frontier, &root_slot, NULL, pool ));
180179
FD_TEST( root_ele->slot == root_slot );
181180

src/discof/restore/utils/fd_sspeer_selector.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,6 @@ fd_sspeer_selector_add( fd_sspeer_selector_t * selector,
275275
if( FD_UNLIKELY( !peer_pool_free( selector->pool ) ) ) return ULONG_MAX;
276276

277277
peer = peer_pool_ele_acquire( selector->pool );
278-
FD_TEST( peer );
279278
if( FD_LIKELY( ssinfo ) ) {
280279
peer->ssinfo = *ssinfo;
281280
} else {

src/discof/restore/utils/fd_ssping.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,6 @@ fd_ssping_add( fd_ssping_t * ssping,
225225
if( FD_LIKELY( !peer ) ) {
226226
if( FD_UNLIKELY( !peer_pool_free( ssping->pool ) ) ) return;
227227
peer = peer_pool_ele_acquire( ssping->pool );
228-
FD_TEST( peer );
229228
memset( peer, 0, sizeof(fd_ssping_peer_t) );
230229
peer->refcnt = 0UL;
231230
peer->state = PEER_STATE_UNPINGED;

src/flamenco/runtime/fd_bank.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,6 @@ fd_bank_footprint( void ) {
5353
FD_LOG_CRIT(( "Failed to acquire " #name " pool element: pool is full" )); \
5454
} \
5555
fd_bank_##name##_t * child_##name = fd_bank_##name##_pool_ele_acquire( name##_pool ); \
56-
if( FD_UNLIKELY( !child_##name ) ) { \
57-
FD_LOG_CRIT(( "Failed to acquire " #name " pool element" )); \
58-
} \
5956
fd_rwlock_unwrite( fd_bank_get_##name##_pool_lock( bank ) ); \
6057
/* If the dirty flag has not been set yet, we need to allocated a */ \
6158
/* new pool element and copy over the data from the parent idx. */ \

src/flamenco/stakes/fd_stake_delegations.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -246,9 +246,6 @@ fd_stake_delegations_update( fd_stake_delegations_t * stake_delegations,
246246
}
247247

248248
fd_stake_delegation_t * stake_delegation = fd_stake_delegation_pool_ele_acquire( stake_delegation_pool );
249-
if( FD_UNLIKELY( !stake_delegation ) ) {
250-
FD_LOG_CRIT(( "unable to acquire stake delegation" ));
251-
}
252249

253250
stake_delegation->stake_account = *stake_account;
254251
stake_delegation->vote_account = *vote_account;

src/flamenco/stakes/fd_vote_states.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,9 +193,6 @@ fd_vote_states_update( fd_vote_states_t * vote_states,
193193
}
194194

195195
fd_vote_state_ele_t * vote_state = fd_vote_state_pool_ele_acquire( vote_state_pool );
196-
if( FD_UNLIKELY( !vote_state ) ) {
197-
FD_LOG_CRIT(( "unable to acquire vote state" ));
198-
}
199196

200197
vote_state->vote_account = *vote_account;
201198
vote_state->stake = 0UL;

0 commit comments

Comments
 (0)