[PATCH] Fix corrupted modesense pages

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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://127.0.0.1/iqn.ronnie.test/1 --test SCSI.ModeSense6.AllPages -V

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@xxxxxxxxx>
---
 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;
-- 
1.7.3.1

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




[Index of Archives]     [Linux SCSI]     [Linux RAID]     [Linux Clusters]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]

  Powered by Linux