From 98fb52432c7fb359d71cdaa3426d5830e02db1e6 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Thu, 9 Apr 2015 15:06:36 +0000 Subject: [PATCH] ib_srpt: Specify a valid completion vector during completion queue creation Avoid that SRP login can fail as follows: kernel: ib_srpt: failed to create CQ: cqe 320; c.v. 17; ret -22 git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6179 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- srpt/src/ib_srpt.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/srpt/src/ib_srpt.c b/srpt/src/ib_srpt.c index 80993cbd3..f1d702d71 100644 --- a/srpt/src/ib_srpt.c +++ b/srpt/src/ib_srpt.c @@ -4218,8 +4218,11 @@ static void srpt_add_one(struct ib_device *device) INIT_LIST_HEAD(&sport->nexus_list); init_waitqueue_head(&sport->ch_releaseQ); mutex_init(&sport->mutex); - for (j = 0; j < COMP_V_MASK_SIZE; j++) + for (j = 0; j < sdev->device->num_comp_vectors; j++) { + if (WARN_ON_ONCE(j >= COMP_V_MASK_SIZE)) + break; __set_bit(j, sport->comp_v_mask); + } #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20) && !defined(BACKPORT_LINUX_WORKQUEUE_TO_2_6_19) /* * A vanilla 2.6.19 or older kernel without backported OFED