[stgt] [PATCH] Fix corrupted modesense pages

Ronnie Sahlberg ronniesahlberg at gmail.com
Sat Jun 8 16:54:07 CEST 2013

Two argumens were swapped in the header to the function for safe writing to the data-out buffer with
the result that any/all modesense data-in we send back to the initiator are mainly garbage.

Fix this and also add tests for this to libiscsi so that we can catch any future regressions :

    ./bin/iscsi-test-cu iscsi:// --test SCSI.ModeSense6.AllPages -V

Signed-off-by: Ronnie Sahlberg <ronniesahlberg at gmail.com>
 usr/spc.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/usr/spc.c b/usr/spc.c
index 074fdad..1f97ca6 100644
--- a/usr/spc.c
+++ b/usr/spc.c
@@ -622,7 +622,7 @@ static int build_mode_page(uint8_t *data, struct mode_pg *pg,
  * Set a byte at the given index within dst buffer to val,
  * not exceeding dst_len bytes available at dst.
-void set_byte_safe(uint8_t *dst, uint32_t dst_len, uint32_t index, int val)
+void set_byte_safe(uint8_t *dst, uint32_t index, uint32_t dst_len, int val)
 	if (index < dst_len)
 		dst[index] = (uint8_t)val;

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

More information about the stgt mailing list