Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ee60bddb authored by Nicholas Bellinger's avatar Nicholas Bellinger
Browse files

target: Fix trailing ASCII space usage in INQUIRY vendor+model



This patch fixes spc_emulate_inquiry_std() to add trailing ASCII
spaces for INQUIRY vendor + model fields following SPC-4 text:

  "ASCII data fields described as being left-aligned shall have any
   unused bytes at the end of the field (i.e., highest offset) and
   the unused bytes shall be filled with ASCII space characters (20h)."

This addresses a problem with Falconstor NSS multipathing.

Reported-by: default avatarTomas Molota <tomas.molota@lightstorm.sk>
Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
parent d4e4ab86
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -97,9 +97,12 @@ spc_emulate_inquiry_std(struct se_cmd *cmd, unsigned char *buf)

	buf[7] = 0x2; /* CmdQue=1 */

	snprintf(&buf[8], 8, "LIO-ORG");
	snprintf(&buf[16], 16, "%s", dev->t10_wwn.model);
	snprintf(&buf[32], 4, "%s", dev->t10_wwn.revision);
	memcpy(&buf[8], "LIO-ORG ", 8);
	memset(&buf[16], 0x20, 16);
	memcpy(&buf[16], dev->t10_wwn.model,
	       min_t(size_t, strlen(dev->t10_wwn.model), 16));
	memcpy(&buf[32], dev->t10_wwn.revision,
	       min_t(size_t, strlen(dev->t10_wwn.revision), 4));
	buf[4] = 31; /* Set additional length to 31 */

	return 0;