[PATCH 5/9] ib_srpt: Fix sport->port_guid formatting code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Nicholas Bellinger <nab@xxxxxxxxxxxxxxx>

This patch fixes the sport->port_guid formatting code in srpt_add_one() to
properly use sport->gid.global.interface_id instead of device->node_guid w/
a port offset.  This requires using ib_query_gid() from srpt_refresh_port(),
so the sport->port_guid assignment has been moved after srpt_refresh_port().

Reported-by: Bart Van Assche <bvanassche@xxxxxxx>
Cc: Bart Van Assche <bvanassche@xxxxxxx>
Cc: Roland Dreier <roland@xxxxxxxxxxxxxxx>
Signed-off-by: Nicholas A. Bellinger <nab@xxxxxxxxxxxxxxx>
---
 drivers/infiniband/ulp/srpt/ib_srpt.c |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c
index 6e19816..ae9fd0e 100644
--- a/drivers/infiniband/ulp/srpt/ib_srpt.c
+++ b/drivers/infiniband/ulp/srpt/ib_srpt.c
@@ -3325,17 +3325,14 @@ static void srpt_add_one(struct ib_device *device)
 		INIT_LIST_HEAD(&sport->port_acl_list);
 		spin_lock_init(&sport->port_acl_lock);
 
-		sprintf(sport->port_guid, "0x0000000000000000%04x%04x%04x%04x",
-                                be16_to_cpu(((__be16 *)&device->node_guid)[0]),
-                                be16_to_cpu(((__be16 *)&device->node_guid)[1]),
-                                be16_to_cpu(((__be16 *)&device->node_guid)[2]),
-                                be16_to_cpu(((__be16 *)&device->node_guid)[3]) + i);
-
 		if (srpt_refresh_port(sport)) {
 			printk(KERN_ERR "MAD registration failed for %s-%d.\n",
 			       srpt_sdev_name(sdev), i);
 			goto err_ring;
 		}
+		snprintf(sport->port_guid, sizeof(sport->port_guid),
+				"0x0000000000000000%016llx",
+				be64_to_cpu(sport->gid.global.interface_id));
 	}
 
 	spin_lock(&srpt_dev_lock);
-- 
1.7.2.5

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux