Re: [PATCH/opensm] Decode the SAPKeyTableRecord block number properly, and don't segv

Alex Netes
2011-02-25T22:02:59Z

On 12:35 Fri 25 Feb , Jason Gunthorpe wrote:
> On Fri, Feb 25, 2011 at 01:25:15PM +0200, Alex Netes wrote:
>
> > > > What is the expected behaviour when IB PKey table block is empty?
> > > > rec.pkey_tbl might be uninitialized here.
> > > > Shouldn't SubnAdmGetResp contain ERR_NO_RECORDS in such case?
> > >
> > > It depends on the method used in the SA query. GetTable never returns
> > > ERR_NO_RECORDS whereas a Get can.
> >
> > In case when IB PKey table block is empty, p_rec_item->rec.pkey_tbl would be uninitialized.
>
> No, it isn't, it is zero.
>
> memset(p_rec_item, 0, sizeof(*p_rec_item));
>
> p_rec_item->rec.lid = lid;
> p_rec_item->rec.block_num = block;
> p_rec_item->rec.port_num = osm_physp_get_port_num(p_physp);
> p_rec_item->rec.pkey_tbl =
> *(osm_pkey_tbl_block_get(osm_physp_get_pkey_tbl(p_physp),
> block));
>
>
> Jason

Sorry. Missed that.