[ofa-general] madeye kernel oops

Sean Hefty sean.hefty at intel.com
Mon Apr 2 12:49:56 PDT 2007


Can you see if this patch fixes your problem?

(I'm not sure how I never hit this before.)

- Sean

---

    IB/madeye: Fix array subscript out of range error.
    
    Signed-off-by: Sean Hefty <sean.hefty at intel.com>

diff --git a/drivers/infiniband/util/madeye/madeye.c
b/drivers/infiniband/util/madeye/madeye.c
index f3d02d1..1b2c384 100644
--- a/drivers/infiniband/util/madeye/madeye.c
+++ b/drivers/infiniband/util/madeye/madeye.c
@@ -533,7 +533,7 @@ static void madeye_add_one(struct ib_device *device)
 		goto out;
 
 	reg_flags = IB_MAD_SNOOP_SEND_COMPLETIONS | IB_MAD_SNOOP_RECVS;
-	for (i = s; i <= e; i++) {
+	for (i = 0; i <= e - s; i++) {
 		port[i].smi_agent = ib_register_mad_snoop(device, i,
 							  IB_QPT_SMI,
 							  reg_flags,
@@ -570,7 +570,7 @@ static void madeye_remove_one(struct ib_device *device)
 		e = device->phys_port_cnt;
 	}
 
-	for (i = s; i <= e; i++) {
+	for (i = 0; i <= e - s; i++) {
 		if (!IS_ERR(port[i].smi_agent))
 			ib_unregister_mad_agent(port[i].smi_agent);
 		if (!IS_ERR(port[i].gsi_agent))




More information about the general mailing list