mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ross Lagerwall <ross.lagerwall@citrix.com>
To: Peter Jones <pjones@redhat.com>,
	Konrad Rzeszutek Wilk <konrad@kernel.org>
Cc: <linux-kernel@vger.kernel.org>,
	Ross Lagerwall <ross.lagerwall@citrix.com>
Subject: [PATCH] iscsi_ibft: Use a field width for target lun sysfs entry
Date: Thu, 27 Jun 2019 16:34:58 +0100	[thread overview]
Message-ID: <20190627153458.22520-1-ross.lagerwall@citrix.com> (raw)

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


                 reply	other threads:[~2019-06-27 15:42 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190627153458.22520-1-ross.lagerwall@citrix.com \
    --to=ross.lagerwall@citrix.com \
    --cc=konrad@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pjones@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®