[openib-general] [PATCH] libibverbs: should not access NULL pointer.
Krishna Kumar
krkumar2 at in.ibm.com
Mon Jan 22 21:34:58 PST 2007
diff -ruNp org/libibverbs/src/device.c new/libibverbs/src/device.c
--- org/libibverbs/src/device.c 2007-01-16 09:11:33.000000000 +0530
+++ new/libibverbs/src/device.c 2007-01-23 10:57:46.000000000 +0530
@@ -63,8 +63,10 @@ struct ibv_device **ibv_get_device_list(
num_devices = ibverbs_init(&device_list);
l = calloc(num_devices + 1, sizeof (struct ibv_device *));
- for (i = 0; i < num_devices; ++i)
- l[i] = device_list[i];
+ if (l) {
+ for (i = 0; i < num_devices; ++i)
+ l[i] = device_list[i];
+ }
pthread_mutex_unlock(&device_list_lock);
More information about the general
mailing list