[openib-general] [PATCH] check create_srq in libibverbs

Shirley Ma xma at us.ibm.com
Fri Dec 9 16:11:03 PST 2005


create_irq is not a mandatory device function, therefor in 
userspace/libibverbs/src/verbs.c ibv_create_srq should check create_srq() 
first before calling it, otherwise the caller will cause the segmentation 
fault on device which doesn't support srq.

Signed-off-by: Shirley Ma <xma at us.ibm.com>

diff -urN userspace/libibverbs/src/verbs.c 
userspace-srq/libibverbs/src/verbs.c
--- userspace/libibverbs/src/verbs.c    2005-11-14 13:44:52.000000000 
-0800
+++ userspace-srq/libibverbs/src/verbs.c        2005-12-09 
16:04:12.022433272 -0800
@@ -246,7 +246,9 @@
 struct ibv_srq *ibv_create_srq(struct ibv_pd *pd,
                               struct ibv_srq_init_attr *srq_init_attr)
 {
-       struct ibv_srq *srq = pd->context->ops.create_srq(pd, 
srq_init_attr);
+       struct ibv_srq *srq = NULL;
+       if (pd->context->ops.create_srq)
+               srq = pd->context->ops.create_srq(pd, srq_init_attr);
 
        if (srq) {
                srq->context          = pd->context;



Thanks
Shirley Ma
IBM Linux Technology Center
15300 SW Koll Parkway
Beaverton, OR 97006-6063
Phone(Fax): (503) 578-7638

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openfabrics.org/pipermail/general/attachments/20051209/04b52ec5/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ibv_srq.patch
Type: application/octet-stream
Size: 605 bytes
Desc: not available
URL: <http://lists.openfabrics.org/pipermail/general/attachments/20051209/04b52ec5/attachment.obj>


More information about the general mailing list