[openib-general] [PATCH] librdmacm: ucma_init reads past end of device_list

Roland Dreier rdreier at cisco.com
Thu Jun 1 15:59:11 PDT 2006


    Boyd> The code currently in place seems to expect there to be a
    Boyd> null element at the end of the dev_list to trigger the end
    Boyd> of the loop.  ibv_get_device_list does not provide such an
    Boyd> entry, but the number of entries is available.  This patch
    Boyd> retrieves that number and loops based on it.  If
    Boyd> ibv_get_device_list should return a list with a null element
    Boyd> at the end, then it is not working correctly.  This patch
    Boyd> will work with either of the possible intended behaviors of
    Boyd> ibv_get_device_list.

This is definitely a bug in libibverbs -- I clearly wrote

 * ibv_get_device_list - Get list of IB devices currently available
 * @num_devices: optional.  if non-NULL, set to the number of devices
 * returned in the array.
 *
 * Return a NULL-terminated array of IB devices.  The array can be
 * released with ibv_free_device_list().

so I intended to return a NULL-terminated array.

I'll fix libibverbs up.

 - R.



More information about the general mailing list