linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iscsi_ibft: Use a field width for target lun sysfs entry
@ 2019-06-27 15:34 Ross Lagerwall
  0 siblings, 0 replies; only message in thread
From: Ross Lagerwall @ 2019-06-27 15:34 UTC (permalink / raw)
  To: Peter Jones, Konrad Rzeszutek Wilk; +Cc: linux-kernel, Ross Lagerwall

The target lun sysfs entry contains the contents of an 8 byte LUN id
formatted as hex. Because a field width is not specified for each byte,
the resulting string is variable length and impossible for userspace to
unambiguously parse. Fix this by using a field width of 2 for each byte
so that the string can be parsed correctly.

Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
---
 drivers/firmware/iscsi_ibft.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/firmware/iscsi_ibft.c b/drivers/firmware/iscsi_ibft.c
index ab3aa3983833..5900edcb6334 100644
--- a/drivers/firmware/iscsi_ibft.c
+++ b/drivers/firmware/iscsi_ibft.c
@@ -371,7 +371,7 @@ static ssize_t ibft_attr_show_target(void *data, int type, char *buf)
 		break;
 	case ISCSI_BOOT_TGT_LUN:
 		for (i = 0; i < 8; i++)
-			str += sprintf(str, "%x", (u8)tgt->lun[i]);
+			str += sprintf(str, "%02x", (u8)tgt->lun[i]);
 		str += sprintf(str, "\n");
 		break;
 	case ISCSI_BOOT_TGT_NIC_ASSOC:
-- 
2.17.2


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2019-06-27 15:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-27 15:34 [PATCH] iscsi_ibft: Use a field width for target lun sysfs entry Ross Lagerwall

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).