Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions opal/class/opal_pointer_array.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,10 @@ int opal_pointer_array_set_item(opal_pointer_array_t *table, int index,
{
assert(table != NULL);

if (OPAL_UNLIKELY(0 > index)) {
return OPAL_ERROR;
}

/* expand table if required to set a specific index */

OPAL_THREAD_LOCK(&(table->lock));
Expand Down
3 changes: 2 additions & 1 deletion opal/class/opal_pointer_array.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

#include "opal/threads/mutex.h"
#include "opal/class/opal_object.h"
#include "opal/prefetch.h"

BEGIN_C_DECLS

Expand Down Expand Up @@ -124,7 +125,7 @@ static inline void *opal_pointer_array_get_item(opal_pointer_array_t *table,
{
void *p;

if( table->size <= element_index ) {
if( OPAL_UNLIKELY(0 > element_index || table->size <= element_index) ) {
return NULL;
}
OPAL_THREAD_LOCK(&(table->lock));
Expand Down