Hi Hal, On 15:39 Mon 11 Apr , Hal Rosenstock wrote: > > Fixes seg fault when ib_pkey_is_invalid called in last_used_pkey_index > > Introduced by commit aebd9f9d9cdd1c60c2b3784c0c03cfe8f4014019 > for better last block handling > > Signed-off-by: Hal Rosenstock <h...@mellanox.com> > --- > diff --git a/opensm/osm_pkey_mgr.c b/opensm/osm_pkey_mgr.c > index 06d9b1e..a2021e9 100644 > --- a/opensm/osm_pkey_mgr.c > +++ b/opensm/osm_pkey_mgr.c > @@ -375,14 +375,19 @@ static int pkey_mgr_update_port(osm_log_t * p_log, > osm_sm_t * sm, > return ret; > } > > -static uint16_t last_used_pkey_index(const osm_port_t * const p_port, > - const osm_pkey_tbl_t * p_pkey_tbl) > +static int last_used_pkey_index(const osm_port_t * const p_port, > + const osm_pkey_tbl_t * p_pkey_tbl, > + uint16_t * p_last_index) > { > ib_pkey_table_t *last_block; > uint16_t index, last_index = 0; > > + CL_ASSERT(p_last_index); > + > last_block = osm_pkey_tbl_new_block_get(p_pkey_tbl, > p_pkey_tbl->used_blocks - 1); > + if (!last_block) > + return 1; > > if (p_pkey_tbl->used_blocks == p_pkey_tbl->max_blocks) > last_index = cl_ntoh16(p_port->p_node->node_info.partition_cap) > % IB_NUM_PKEY_ELEMENTS_IN_BLOCK; > @@ -395,7 +400,8 @@ static uint16_t last_used_pkey_index(const osm_port_t * > const p_port, > break; > } while (index != 0); > > - return index; > + *p_last_index = index;
I think it should be: *p_last_index = index + 1; You want to return the number of pkeys in the block and not the index in the array. -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html