From bb8fb4e6840ecebdc61f7ebd0653187e7128dde5 Mon Sep 17 00:00:00 2001 From: Mike Christie Date: Tue, 2 Sep 2008 14:36:07 -0700 Subject: ibft: fix target info parsing in ibft module I got this patch through Red Hat's bugzilla from the bug submitter and patch creator. I have just fixed it up so it applies without fuzz to upstream kernels. Original patch and description from Shyam kumar Iyer: The issue [ibft module not displaying targets with short names] is because of an offset calculatation error in the iscsi_ibft.c code. Due to this error directory structure for the target in /sys/firmware/ibft does not get created and so the initiator is unable to connect to the target. Note that this bug surfaced only with an name that had a short section at the end. eg: "iqn.1984-05.com.dell:dell". It did not surface when the iqn's had a longer section at the end. eg: "iqn.2001-04.com.example:storage.disk2.sys1.xyz" So, the eot_offset was calculated such that an extra 48 bytes i.e. the size of the ibft_header which has already been accounted was subtracted twice. This was not evident with longer iqn names because they would overshoot the total ibft length more than 48 bytes and thus would escape the bug. Signed-off-by: Shyam Kumar Iyer Signed-off-by: Mike Christie Cc: Konrad Rzeszutek Cc: Peter Jones Cc: James Bottomley Cc: Greg Kroah-Hartman Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/firmware/iscsi_ibft.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/firmware/iscsi_ibft.c') diff --git a/drivers/firmware/iscsi_ibft.c b/drivers/firmware/iscsi_ibft.c index 8024e3bfd87..b91ef63126e 100644 --- a/drivers/firmware/iscsi_ibft.c +++ b/drivers/firmware/iscsi_ibft.c @@ -669,8 +669,7 @@ static int __init ibft_register_kobjects(struct ibft_table_header *header, control = (void *)header + sizeof(*header); end = (void *)control + control->hdr.length; - eot_offset = (void *)header + header->length - - (void *)control - sizeof(*header); + eot_offset = (void *)header + header->length - (void *)control; rc = ibft_verify_hdr("control", (struct ibft_hdr *)control, id_control, sizeof(*control)); -- cgit v1.2.3 From 9cf899d12583082c77a0fcc758f3179b440518ee Mon Sep 17 00:00:00 2001 From: Adrian Bunk Date: Tue, 12 Aug 2008 15:43:59 -0400 Subject: drivers/firmware/iscsi_ibft.c: make 3 functions static This patch makes the following needlessly global functions static: - ibft_attr_show_initiator() - ibft_attr_show_nic() - ibft_attr_show_target() Signed-off-by: Adrian Bunk Signed-off-by: Konrad Rzeszutek Signed-off-by: Greg Kroah-Hartman --- drivers/firmware/iscsi_ibft.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'drivers/firmware/iscsi_ibft.c') diff --git a/drivers/firmware/iscsi_ibft.c b/drivers/firmware/iscsi_ibft.c index b91ef63126e..deb154aa47c 100644 --- a/drivers/firmware/iscsi_ibft.c +++ b/drivers/firmware/iscsi_ibft.c @@ -334,9 +334,9 @@ static void ibft_release(struct kobject *kobj) /* * Routines for parsing the iBFT data to be human readable. */ -ssize_t ibft_attr_show_initiator(struct ibft_kobject *entry, - struct ibft_attribute *attr, - char *buf) +static ssize_t ibft_attr_show_initiator(struct ibft_kobject *entry, + struct ibft_attribute *attr, + char *buf) { struct ibft_initiator *initiator = entry->initiator; void *ibft_loc = entry->header; @@ -376,9 +376,9 @@ ssize_t ibft_attr_show_initiator(struct ibft_kobject *entry, return str - buf; } -ssize_t ibft_attr_show_nic(struct ibft_kobject *entry, - struct ibft_attribute *attr, - char *buf) +static ssize_t ibft_attr_show_nic(struct ibft_kobject *entry, + struct ibft_attribute *attr, + char *buf) { struct ibft_nic *nic = entry->nic; void *ibft_loc = entry->header; @@ -440,9 +440,9 @@ ssize_t ibft_attr_show_nic(struct ibft_kobject *entry, return str - buf; }; -ssize_t ibft_attr_show_target(struct ibft_kobject *entry, - struct ibft_attribute *attr, - char *buf) +static ssize_t ibft_attr_show_target(struct ibft_kobject *entry, + struct ibft_attribute *attr, + char *buf) { struct ibft_tgt *tgt = entry->tgt; void *ibft_loc = entry->header; -- cgit v1.2.3