If the program decides to add a pkey to block 1. It might not allocate memory
for block 0. As a result, when the program searches for a pkey, it might try
access a not allocated block.

Signed-off-by: Daniel Klein <[email protected]>
Signed-off-by: Hal Rosenstock <[email protected]>
Signed-off-by: Alex Netes <[email protected]>
---
 opensm/osm_pkey_mgr.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/opensm/osm_pkey_mgr.c b/opensm/osm_pkey_mgr.c
index 52c2280..d051026 100644
--- a/opensm/osm_pkey_mgr.c
+++ b/opensm/osm_pkey_mgr.c
@@ -556,6 +556,9 @@ static int new_pkey_exists(osm_pkey_tbs_t * p_pkey_tbl, 
ib_net16_t pkey)
        num_blocks = (uint16_t) cl_ptr_vector_get_size(&p_pkey_tbl->new_blocks);
        for (block_index = 0; block_index < num_blocks; block_index++) {
                block = osm_pkey_tbl_new_block_get(p_pkey_tbl, block_index);
+               if (!block)
+                       continue;
+
                for (pkey_idx = 0; pkey_idx < IB_NUM_PKEY_ELEMENTS_IN_BLOCK;
                     pkey_idx++) {
                        if (block->pkey_entry[pkey_idx] == pkey)
-- 
1.7.7.6

-- Alex
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to