test_*_dpo*: Fix NULL pointer dereferences
Avoid that the DPO / DPOFUA tests triggers a NULL pointer dereference if the MODE SENSE command in these tests fails. Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
This commit is contained in:
committed by
Ronnie Sahlberg
parent
35b8d6a45f
commit
0995b0aa2b
@@ -28,7 +28,7 @@
|
|||||||
void
|
void
|
||||||
test_compareandwrite_dpofua(void)
|
test_compareandwrite_dpofua(void)
|
||||||
{
|
{
|
||||||
int ret, dpofua;
|
int ret, dpofua, usage_data_dpofua;
|
||||||
struct scsi_task *ms_task = NULL;
|
struct scsi_task *ms_task = NULL;
|
||||||
struct scsi_mode_sense *ms;
|
struct scsi_mode_sense *ms;
|
||||||
struct scsi_task *rso_task = NULL;
|
struct scsi_task *rso_task = NULL;
|
||||||
@@ -48,7 +48,7 @@ test_compareandwrite_dpofua(void)
|
|||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
logging(LOG_VERBOSE, "[SUCCESS] Mode sense returned status GOOD");
|
logging(LOG_VERBOSE, "[SUCCESS] Mode sense returned status GOOD");
|
||||||
ms = scsi_datain_unmarshall(ms_task);
|
ms = scsi_datain_unmarshall(ms_task);
|
||||||
dpofua = !!(ms->device_specific_parameter & 0x10);
|
dpofua = ms && (ms->device_specific_parameter & 0x10);
|
||||||
scsi_free_scsi_task(ms_task);
|
scsi_free_scsi_task(ms_task);
|
||||||
|
|
||||||
if (dpofua) {
|
if (dpofua) {
|
||||||
@@ -114,14 +114,15 @@ test_compareandwrite_dpofua(void)
|
|||||||
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
|
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
|
||||||
rsoc = scsi_datain_unmarshall(rso_task);
|
rsoc = scsi_datain_unmarshall(rso_task);
|
||||||
CU_ASSERT_NOT_EQUAL(rsoc, NULL);
|
CU_ASSERT_NOT_EQUAL(rsoc, NULL);
|
||||||
|
usage_data_dpofua = rsoc ? rsoc->cdb_usage_data[1] & 0x18 : -1;
|
||||||
if (dpofua) {
|
if (dpofua) {
|
||||||
logging(LOG_VERBOSE, "DPOFUA is set. Verify the DPO/FUA flags "
|
logging(LOG_VERBOSE, "DPOFUA is set. Verify the DPO/FUA flags "
|
||||||
"are set in the CDB_USAGE_DATA");
|
"are set in the CDB_USAGE_DATA");
|
||||||
CU_ASSERT_EQUAL(rsoc->cdb_usage_data[1] & 0x18, 0x18);
|
CU_ASSERT_EQUAL(usage_data_dpofua, 0x18);
|
||||||
} else {
|
} else {
|
||||||
logging(LOG_VERBOSE, "DPOFUA is clear. Verify the DPO/FUA "
|
logging(LOG_VERBOSE, "DPOFUA is clear. Verify the DPO/FUA "
|
||||||
"flags are clear in the CDB_USAGE_DATA");
|
"flags are clear in the CDB_USAGE_DATA");
|
||||||
CU_ASSERT_EQUAL(rsoc->cdb_usage_data[1] & 0x18, 0x00);
|
CU_ASSERT_EQUAL(usage_data_dpofua, 0x00);
|
||||||
}
|
}
|
||||||
scsi_free_scsi_task(rso_task);
|
scsi_free_scsi_task(rso_task);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
void
|
void
|
||||||
test_orwrite_dpofua(void)
|
test_orwrite_dpofua(void)
|
||||||
{
|
{
|
||||||
int ret, dpofua;
|
int ret, dpofua, usage_data_dpofua;
|
||||||
struct scsi_task *ms_task = NULL;
|
struct scsi_task *ms_task = NULL;
|
||||||
struct scsi_mode_sense *ms;
|
struct scsi_mode_sense *ms;
|
||||||
struct scsi_task *rso_task = NULL;
|
struct scsi_task *rso_task = NULL;
|
||||||
@@ -48,7 +48,7 @@ test_orwrite_dpofua(void)
|
|||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
logging(LOG_VERBOSE, "[SUCCESS] Mode sense returned status GOOD");
|
logging(LOG_VERBOSE, "[SUCCESS] Mode sense returned status GOOD");
|
||||||
ms = scsi_datain_unmarshall(ms_task);
|
ms = scsi_datain_unmarshall(ms_task);
|
||||||
dpofua = !!(ms->device_specific_parameter & 0x10);
|
dpofua = ms && (ms->device_specific_parameter & 0x10);
|
||||||
scsi_free_scsi_task(ms_task);
|
scsi_free_scsi_task(ms_task);
|
||||||
|
|
||||||
if (dpofua) {
|
if (dpofua) {
|
||||||
@@ -124,14 +124,15 @@ test_orwrite_dpofua(void)
|
|||||||
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
|
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
|
||||||
rsoc = scsi_datain_unmarshall(rso_task);
|
rsoc = scsi_datain_unmarshall(rso_task);
|
||||||
CU_ASSERT_NOT_EQUAL(rsoc, NULL);
|
CU_ASSERT_NOT_EQUAL(rsoc, NULL);
|
||||||
|
usage_data_dpofua = rsoc ? rsoc->cdb_usage_data[1] & 0x18 : -1;
|
||||||
if (dpofua) {
|
if (dpofua) {
|
||||||
logging(LOG_VERBOSE, "DPOFUA is set. Verify the DPO/FUA flags "
|
logging(LOG_VERBOSE, "DPOFUA is set. Verify the DPO/FUA flags "
|
||||||
"are set in the CDB_USAGE_DATA");
|
"are set in the CDB_USAGE_DATA");
|
||||||
CU_ASSERT_EQUAL(rsoc->cdb_usage_data[1] & 0x18, 0x18);
|
CU_ASSERT_EQUAL(usage_data_dpofua, 0x18);
|
||||||
} else {
|
} else {
|
||||||
logging(LOG_VERBOSE, "DPOFUA is clear. Verify the DPO/FUA "
|
logging(LOG_VERBOSE, "DPOFUA is clear. Verify the DPO/FUA "
|
||||||
"flags are clear in the CDB_USAGE_DATA");
|
"flags are clear in the CDB_USAGE_DATA");
|
||||||
CU_ASSERT_EQUAL(rsoc->cdb_usage_data[1] & 0x18, 0x00);
|
CU_ASSERT_EQUAL(usage_data_dpofua, 0x00);
|
||||||
}
|
}
|
||||||
scsi_free_scsi_task(rso_task);
|
scsi_free_scsi_task(rso_task);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
void
|
void
|
||||||
test_read10_dpofua(void)
|
test_read10_dpofua(void)
|
||||||
{
|
{
|
||||||
int ret, dpofua;
|
int ret, dpofua, usage_data_dpofua;
|
||||||
struct scsi_task *ms_task = NULL;
|
struct scsi_task *ms_task = NULL;
|
||||||
struct scsi_mode_sense *ms;
|
struct scsi_mode_sense *ms;
|
||||||
struct scsi_task *rso_task = NULL;
|
struct scsi_task *rso_task = NULL;
|
||||||
@@ -46,7 +46,7 @@ test_read10_dpofua(void)
|
|||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
logging(LOG_VERBOSE, "[SUCCESS] Mode sense returned status GOOD");
|
logging(LOG_VERBOSE, "[SUCCESS] Mode sense returned status GOOD");
|
||||||
ms = scsi_datain_unmarshall(ms_task);
|
ms = scsi_datain_unmarshall(ms_task);
|
||||||
dpofua = !!(ms->device_specific_parameter & 0x10);
|
dpofua = ms && (ms->device_specific_parameter & 0x10);
|
||||||
scsi_free_scsi_task(ms_task);
|
scsi_free_scsi_task(ms_task);
|
||||||
|
|
||||||
if (dpofua) {
|
if (dpofua) {
|
||||||
@@ -113,14 +113,15 @@ test_read10_dpofua(void)
|
|||||||
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
|
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
|
||||||
rsoc = scsi_datain_unmarshall(rso_task);
|
rsoc = scsi_datain_unmarshall(rso_task);
|
||||||
CU_ASSERT_NOT_EQUAL(rsoc, NULL);
|
CU_ASSERT_NOT_EQUAL(rsoc, NULL);
|
||||||
|
usage_data_dpofua = rsoc ? rsoc->cdb_usage_data[1] & 0x18 : -1;
|
||||||
if (dpofua) {
|
if (dpofua) {
|
||||||
logging(LOG_VERBOSE, "DPOFUA is set. Verify the DPO/FUA flags "
|
logging(LOG_VERBOSE, "DPOFUA is set. Verify the DPO/FUA flags "
|
||||||
"are set in the CDB_USAGE_DATA");
|
"are set in the CDB_USAGE_DATA");
|
||||||
CU_ASSERT_EQUAL(rsoc->cdb_usage_data[1] & 0x18, 0x18);
|
CU_ASSERT_EQUAL(usage_data_dpofua, 0x18);
|
||||||
} else {
|
} else {
|
||||||
logging(LOG_VERBOSE, "DPOFUA is clear. Verify the DPO/FUA "
|
logging(LOG_VERBOSE, "DPOFUA is clear. Verify the DPO/FUA "
|
||||||
"flags are clear in the CDB_USAGE_DATA");
|
"flags are clear in the CDB_USAGE_DATA");
|
||||||
CU_ASSERT_EQUAL(rsoc->cdb_usage_data[1] & 0x18, 0x00);
|
CU_ASSERT_EQUAL(usage_data_dpofua, 0x00);
|
||||||
}
|
}
|
||||||
scsi_free_scsi_task(rso_task);
|
scsi_free_scsi_task(rso_task);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
void
|
void
|
||||||
test_read12_dpofua(void)
|
test_read12_dpofua(void)
|
||||||
{
|
{
|
||||||
int ret, dpofua;
|
int ret, dpofua, usage_data_dpofua;
|
||||||
struct scsi_task *ms_task = NULL;
|
struct scsi_task *ms_task = NULL;
|
||||||
struct scsi_mode_sense *ms;
|
struct scsi_mode_sense *ms;
|
||||||
struct scsi_task *rso_task = NULL;
|
struct scsi_task *rso_task = NULL;
|
||||||
@@ -46,7 +46,7 @@ test_read12_dpofua(void)
|
|||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
logging(LOG_VERBOSE, "[SUCCESS] Mode sense returned status GOOD");
|
logging(LOG_VERBOSE, "[SUCCESS] Mode sense returned status GOOD");
|
||||||
ms = scsi_datain_unmarshall(ms_task);
|
ms = scsi_datain_unmarshall(ms_task);
|
||||||
dpofua = !!(ms->device_specific_parameter & 0x10);
|
dpofua = ms && (ms->device_specific_parameter & 0x10);
|
||||||
scsi_free_scsi_task(ms_task);
|
scsi_free_scsi_task(ms_task);
|
||||||
|
|
||||||
if (dpofua) {
|
if (dpofua) {
|
||||||
@@ -112,14 +112,15 @@ test_read12_dpofua(void)
|
|||||||
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
|
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
|
||||||
rsoc = scsi_datain_unmarshall(rso_task);
|
rsoc = scsi_datain_unmarshall(rso_task);
|
||||||
CU_ASSERT_NOT_EQUAL(rsoc, NULL);
|
CU_ASSERT_NOT_EQUAL(rsoc, NULL);
|
||||||
|
usage_data_dpofua = rsoc ? rsoc->cdb_usage_data[1] & 0x18 : -1;
|
||||||
if (dpofua) {
|
if (dpofua) {
|
||||||
logging(LOG_VERBOSE, "DPOFUA is set. Verify the DPO/FUA flags "
|
logging(LOG_VERBOSE, "DPOFUA is set. Verify the DPO/FUA flags "
|
||||||
"are set in the CDB_USAGE_DATA");
|
"are set in the CDB_USAGE_DATA");
|
||||||
CU_ASSERT_EQUAL(rsoc->cdb_usage_data[1] & 0x18, 0x18);
|
CU_ASSERT_EQUAL(usage_data_dpofua, 0x18);
|
||||||
} else {
|
} else {
|
||||||
logging(LOG_VERBOSE, "DPOFUA is clear. Verify the DPO/FUA "
|
logging(LOG_VERBOSE, "DPOFUA is clear. Verify the DPO/FUA "
|
||||||
"flags are clear in the CDB_USAGE_DATA");
|
"flags are clear in the CDB_USAGE_DATA");
|
||||||
CU_ASSERT_EQUAL(rsoc->cdb_usage_data[1] & 0x18, 0x00);
|
CU_ASSERT_EQUAL(usage_data_dpofua, 0x00);
|
||||||
}
|
}
|
||||||
scsi_free_scsi_task(rso_task);
|
scsi_free_scsi_task(rso_task);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
void
|
void
|
||||||
test_read16_dpofua(void)
|
test_read16_dpofua(void)
|
||||||
{
|
{
|
||||||
int ret, dpofua;
|
int ret, dpofua, usage_data_dpofua;
|
||||||
struct scsi_task *ms_task = NULL;
|
struct scsi_task *ms_task = NULL;
|
||||||
struct scsi_mode_sense *ms;
|
struct scsi_mode_sense *ms;
|
||||||
struct scsi_task *rso_task = NULL;
|
struct scsi_task *rso_task = NULL;
|
||||||
@@ -46,7 +46,7 @@ test_read16_dpofua(void)
|
|||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
logging(LOG_VERBOSE, "[SUCCESS] Mode sense returned status GOOD");
|
logging(LOG_VERBOSE, "[SUCCESS] Mode sense returned status GOOD");
|
||||||
ms = scsi_datain_unmarshall(ms_task);
|
ms = scsi_datain_unmarshall(ms_task);
|
||||||
dpofua = !!(ms->device_specific_parameter & 0x10);
|
dpofua = ms && (ms->device_specific_parameter & 0x10);
|
||||||
scsi_free_scsi_task(ms_task);
|
scsi_free_scsi_task(ms_task);
|
||||||
|
|
||||||
if (dpofua) {
|
if (dpofua) {
|
||||||
@@ -113,14 +113,15 @@ test_read16_dpofua(void)
|
|||||||
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
|
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
|
||||||
rsoc = scsi_datain_unmarshall(rso_task);
|
rsoc = scsi_datain_unmarshall(rso_task);
|
||||||
CU_ASSERT_NOT_EQUAL(rsoc, NULL);
|
CU_ASSERT_NOT_EQUAL(rsoc, NULL);
|
||||||
|
usage_data_dpofua = rsoc ? rsoc->cdb_usage_data[1] & 0x18 : -1;
|
||||||
if (dpofua) {
|
if (dpofua) {
|
||||||
logging(LOG_VERBOSE, "DPOFUA is set. Verify the DPO/FUA flags "
|
logging(LOG_VERBOSE, "DPOFUA is set. Verify the DPO/FUA flags "
|
||||||
"are set in the CDB_USAGE_DATA");
|
"are set in the CDB_USAGE_DATA");
|
||||||
CU_ASSERT_EQUAL(rsoc->cdb_usage_data[1] & 0x18, 0x18);
|
CU_ASSERT_EQUAL(usage_data_dpofua, 0x18);
|
||||||
} else {
|
} else {
|
||||||
logging(LOG_VERBOSE, "DPOFUA is clear. Verify the DPO/FUA "
|
logging(LOG_VERBOSE, "DPOFUA is clear. Verify the DPO/FUA "
|
||||||
"flags are clear in the CDB_USAGE_DATA");
|
"flags are clear in the CDB_USAGE_DATA");
|
||||||
CU_ASSERT_EQUAL(rsoc->cdb_usage_data[1] & 0x18, 0x00);
|
CU_ASSERT_EQUAL(usage_data_dpofua, 0x00);
|
||||||
}
|
}
|
||||||
scsi_free_scsi_task(rso_task);
|
scsi_free_scsi_task(rso_task);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
void
|
void
|
||||||
test_verify10_dpo(void)
|
test_verify10_dpo(void)
|
||||||
{
|
{
|
||||||
int ret, dpofua;
|
int ret, dpofua, usage_data_dpo;
|
||||||
struct scsi_task *ms_task = NULL;
|
struct scsi_task *ms_task = NULL;
|
||||||
struct scsi_mode_sense *ms;
|
struct scsi_mode_sense *ms;
|
||||||
struct scsi_task *rso_task = NULL;
|
struct scsi_task *rso_task = NULL;
|
||||||
@@ -52,7 +52,7 @@ test_verify10_dpo(void)
|
|||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
logging(LOG_VERBOSE, "[SUCCESS] Mode sense returned status GOOD");
|
logging(LOG_VERBOSE, "[SUCCESS] Mode sense returned status GOOD");
|
||||||
ms = scsi_datain_unmarshall(ms_task);
|
ms = scsi_datain_unmarshall(ms_task);
|
||||||
dpofua = !!(ms->device_specific_parameter & 0x10);
|
dpofua = ms && (ms->device_specific_parameter & 0x10);
|
||||||
scsi_free_scsi_task(ms_task);
|
scsi_free_scsi_task(ms_task);
|
||||||
|
|
||||||
if (dpofua) {
|
if (dpofua) {
|
||||||
@@ -102,14 +102,15 @@ test_verify10_dpo(void)
|
|||||||
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
|
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
|
||||||
rsoc = scsi_datain_unmarshall(rso_task);
|
rsoc = scsi_datain_unmarshall(rso_task);
|
||||||
CU_ASSERT_NOT_EQUAL(rsoc, NULL);
|
CU_ASSERT_NOT_EQUAL(rsoc, NULL);
|
||||||
|
usage_data_dpo = rsoc ? rsoc->cdb_usage_data[1] & 0x10 : -1;
|
||||||
if (dpofua) {
|
if (dpofua) {
|
||||||
logging(LOG_VERBOSE, "DPOFUA is set. Verify the DPO flag "
|
logging(LOG_VERBOSE, "DPOFUA is set. Verify the DPO flag "
|
||||||
"is set in the CDB_USAGE_DATA");
|
"is set in the CDB_USAGE_DATA");
|
||||||
CU_ASSERT_EQUAL(rsoc->cdb_usage_data[1] & 0x10, 0x10);
|
CU_ASSERT_EQUAL(usage_data_dpo, 0x10);
|
||||||
} else {
|
} else {
|
||||||
logging(LOG_VERBOSE, "DPOFUA is clear. Verify the DPO "
|
logging(LOG_VERBOSE, "DPOFUA is clear. Verify the DPO "
|
||||||
"flag is clear in the CDB_USAGE_DATA");
|
"flag is clear in the CDB_USAGE_DATA");
|
||||||
CU_ASSERT_EQUAL(rsoc->cdb_usage_data[1] & 0x10, 0x00);
|
CU_ASSERT_EQUAL(usage_data_dpo, 0x00);
|
||||||
}
|
}
|
||||||
scsi_free_scsi_task(rso_task);
|
scsi_free_scsi_task(rso_task);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
void
|
void
|
||||||
test_verify12_dpo(void)
|
test_verify12_dpo(void)
|
||||||
{
|
{
|
||||||
int ret, dpofua;
|
int ret, dpofua, usage_data_dpo;
|
||||||
struct scsi_task *ms_task = NULL;
|
struct scsi_task *ms_task = NULL;
|
||||||
struct scsi_mode_sense *ms;
|
struct scsi_mode_sense *ms;
|
||||||
struct scsi_task *rso_task = NULL;
|
struct scsi_task *rso_task = NULL;
|
||||||
@@ -52,7 +52,7 @@ test_verify12_dpo(void)
|
|||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
logging(LOG_VERBOSE, "[SUCCESS] Mode sense returned status GOOD");
|
logging(LOG_VERBOSE, "[SUCCESS] Mode sense returned status GOOD");
|
||||||
ms = scsi_datain_unmarshall(ms_task);
|
ms = scsi_datain_unmarshall(ms_task);
|
||||||
dpofua = !!(ms->device_specific_parameter & 0x10);
|
dpofua = ms && (ms->device_specific_parameter & 0x10);
|
||||||
scsi_free_scsi_task(ms_task);
|
scsi_free_scsi_task(ms_task);
|
||||||
|
|
||||||
if (dpofua) {
|
if (dpofua) {
|
||||||
@@ -102,14 +102,15 @@ test_verify12_dpo(void)
|
|||||||
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
|
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
|
||||||
rsoc = scsi_datain_unmarshall(rso_task);
|
rsoc = scsi_datain_unmarshall(rso_task);
|
||||||
CU_ASSERT_NOT_EQUAL(rsoc, NULL);
|
CU_ASSERT_NOT_EQUAL(rsoc, NULL);
|
||||||
|
usage_data_dpo = rsoc ? rsoc->cdb_usage_data[1] & 0x10 : -1;
|
||||||
if (dpofua) {
|
if (dpofua) {
|
||||||
logging(LOG_VERBOSE, "DPOFUA is set. Verify the DPO flag "
|
logging(LOG_VERBOSE, "DPOFUA is set. Verify the DPO flag "
|
||||||
"is set in the CDB_USAGE_DATA");
|
"is set in the CDB_USAGE_DATA");
|
||||||
CU_ASSERT_EQUAL(rsoc->cdb_usage_data[1] & 0x10, 0x10);
|
CU_ASSERT_EQUAL(usage_data_dpo, 0x10);
|
||||||
} else {
|
} else {
|
||||||
logging(LOG_VERBOSE, "DPOFUA is clear. Verify the DPO "
|
logging(LOG_VERBOSE, "DPOFUA is clear. Verify the DPO "
|
||||||
"flag is clear in the CDB_USAGE_DATA");
|
"flag is clear in the CDB_USAGE_DATA");
|
||||||
CU_ASSERT_EQUAL(rsoc->cdb_usage_data[1] & 0x10, 0x00);
|
CU_ASSERT_EQUAL(usage_data_dpo, 0x00);
|
||||||
}
|
}
|
||||||
scsi_free_scsi_task(rso_task);
|
scsi_free_scsi_task(rso_task);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
void
|
void
|
||||||
test_verify16_dpo(void)
|
test_verify16_dpo(void)
|
||||||
{
|
{
|
||||||
int ret, dpofua;
|
int ret, dpofua, usage_data_dpo;
|
||||||
struct scsi_task *ms_task = NULL;
|
struct scsi_task *ms_task = NULL;
|
||||||
struct scsi_mode_sense *ms;
|
struct scsi_mode_sense *ms;
|
||||||
struct scsi_task *rso_task = NULL;
|
struct scsi_task *rso_task = NULL;
|
||||||
@@ -52,7 +52,7 @@ test_verify16_dpo(void)
|
|||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
logging(LOG_VERBOSE, "[SUCCESS] Mode sense returned status GOOD");
|
logging(LOG_VERBOSE, "[SUCCESS] Mode sense returned status GOOD");
|
||||||
ms = scsi_datain_unmarshall(ms_task);
|
ms = scsi_datain_unmarshall(ms_task);
|
||||||
dpofua = !!(ms->device_specific_parameter & 0x10);
|
dpofua = ms && (ms->device_specific_parameter & 0x10);
|
||||||
scsi_free_scsi_task(ms_task);
|
scsi_free_scsi_task(ms_task);
|
||||||
|
|
||||||
if (dpofua) {
|
if (dpofua) {
|
||||||
@@ -102,14 +102,15 @@ test_verify16_dpo(void)
|
|||||||
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
|
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
|
||||||
rsoc = scsi_datain_unmarshall(rso_task);
|
rsoc = scsi_datain_unmarshall(rso_task);
|
||||||
CU_ASSERT_NOT_EQUAL(rsoc, NULL);
|
CU_ASSERT_NOT_EQUAL(rsoc, NULL);
|
||||||
|
usage_data_dpo = rsoc ? rsoc->cdb_usage_data[1] & 0x10 : -1;
|
||||||
if (dpofua) {
|
if (dpofua) {
|
||||||
logging(LOG_VERBOSE, "DPOFUA is set. Verify the DPO flag "
|
logging(LOG_VERBOSE, "DPOFUA is set. Verify the DPO flag "
|
||||||
"is set in the CDB_USAGE_DATA");
|
"is set in the CDB_USAGE_DATA");
|
||||||
CU_ASSERT_EQUAL(rsoc->cdb_usage_data[1] & 0x10, 0x10);
|
CU_ASSERT_EQUAL(usage_data_dpo, 0x10);
|
||||||
} else {
|
} else {
|
||||||
logging(LOG_VERBOSE, "DPOFUA is clear. Verify the DPO "
|
logging(LOG_VERBOSE, "DPOFUA is clear. Verify the DPO "
|
||||||
"flag is clear in the CDB_USAGE_DATA");
|
"flag is clear in the CDB_USAGE_DATA");
|
||||||
CU_ASSERT_EQUAL(rsoc->cdb_usage_data[1] & 0x10, 0x00);
|
CU_ASSERT_EQUAL(usage_data_dpo, 0x00);
|
||||||
}
|
}
|
||||||
scsi_free_scsi_task(rso_task);
|
scsi_free_scsi_task(rso_task);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
void
|
void
|
||||||
test_write10_dpofua(void)
|
test_write10_dpofua(void)
|
||||||
{
|
{
|
||||||
int ret, dpofua;
|
int ret, dpofua, usage_data_dpofua;
|
||||||
struct scsi_task *ms_task = NULL;
|
struct scsi_task *ms_task = NULL;
|
||||||
struct scsi_mode_sense *ms;
|
struct scsi_mode_sense *ms;
|
||||||
struct scsi_task *rso_task = NULL;
|
struct scsi_task *rso_task = NULL;
|
||||||
@@ -48,7 +48,7 @@ test_write10_dpofua(void)
|
|||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
logging(LOG_VERBOSE, "[SUCCESS] Mode sense returned status GOOD");
|
logging(LOG_VERBOSE, "[SUCCESS] Mode sense returned status GOOD");
|
||||||
ms = scsi_datain_unmarshall(ms_task);
|
ms = scsi_datain_unmarshall(ms_task);
|
||||||
dpofua = !!(ms->device_specific_parameter & 0x10);
|
dpofua = ms && (ms->device_specific_parameter & 0x10);
|
||||||
scsi_free_scsi_task(ms_task);
|
scsi_free_scsi_task(ms_task);
|
||||||
|
|
||||||
if (dpofua) {
|
if (dpofua) {
|
||||||
@@ -115,14 +115,15 @@ test_write10_dpofua(void)
|
|||||||
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
|
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
|
||||||
rsoc = scsi_datain_unmarshall(rso_task);
|
rsoc = scsi_datain_unmarshall(rso_task);
|
||||||
CU_ASSERT_NOT_EQUAL(rsoc, NULL);
|
CU_ASSERT_NOT_EQUAL(rsoc, NULL);
|
||||||
|
usage_data_dpofua = rsoc ? rsoc->cdb_usage_data[1] & 0x18 : -1;
|
||||||
if (dpofua) {
|
if (dpofua) {
|
||||||
logging(LOG_VERBOSE, "DPOFUA is set. Verify the DPO/FUA flags "
|
logging(LOG_VERBOSE, "DPOFUA is set. Verify the DPO/FUA flags "
|
||||||
"are set in the CDB_USAGE_DATA");
|
"are set in the CDB_USAGE_DATA");
|
||||||
CU_ASSERT_EQUAL(rsoc->cdb_usage_data[1] & 0x18, 0x18);
|
CU_ASSERT_EQUAL(usage_data_dpofua, 0x18);
|
||||||
} else {
|
} else {
|
||||||
logging(LOG_VERBOSE, "DPOFUA is clear. Verify the DPO/FUA "
|
logging(LOG_VERBOSE, "DPOFUA is clear. Verify the DPO/FUA "
|
||||||
"flags are clear in the CDB_USAGE_DATA");
|
"flags are clear in the CDB_USAGE_DATA");
|
||||||
CU_ASSERT_EQUAL(rsoc->cdb_usage_data[1] & 0x18, 0x00);
|
CU_ASSERT_EQUAL(usage_data_dpofua, 0x00);
|
||||||
}
|
}
|
||||||
scsi_free_scsi_task(rso_task);
|
scsi_free_scsi_task(rso_task);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
void
|
void
|
||||||
test_write12_dpofua(void)
|
test_write12_dpofua(void)
|
||||||
{
|
{
|
||||||
int ret, dpofua;
|
int ret, dpofua, usage_data_dpofua;
|
||||||
struct scsi_task *ms_task = NULL;
|
struct scsi_task *ms_task = NULL;
|
||||||
struct scsi_mode_sense *ms;
|
struct scsi_mode_sense *ms;
|
||||||
struct scsi_task *rso_task = NULL;
|
struct scsi_task *rso_task = NULL;
|
||||||
@@ -48,7 +48,7 @@ test_write12_dpofua(void)
|
|||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
logging(LOG_VERBOSE, "[SUCCESS] Mode sense returned status GOOD");
|
logging(LOG_VERBOSE, "[SUCCESS] Mode sense returned status GOOD");
|
||||||
ms = scsi_datain_unmarshall(ms_task);
|
ms = scsi_datain_unmarshall(ms_task);
|
||||||
dpofua = !!(ms->device_specific_parameter & 0x10);
|
dpofua = ms && (ms->device_specific_parameter & 0x10);
|
||||||
scsi_free_scsi_task(ms_task);
|
scsi_free_scsi_task(ms_task);
|
||||||
|
|
||||||
if (dpofua) {
|
if (dpofua) {
|
||||||
@@ -125,14 +125,15 @@ test_write12_dpofua(void)
|
|||||||
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
|
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
|
||||||
rsoc = scsi_datain_unmarshall(rso_task);
|
rsoc = scsi_datain_unmarshall(rso_task);
|
||||||
CU_ASSERT_NOT_EQUAL(rsoc, NULL);
|
CU_ASSERT_NOT_EQUAL(rsoc, NULL);
|
||||||
|
usage_data_dpofua = rsoc ? rsoc->cdb_usage_data[1] & 0x18 : -1;
|
||||||
if (dpofua) {
|
if (dpofua) {
|
||||||
logging(LOG_VERBOSE, "DPOFUA is set. Verify the DPO/FUA flags "
|
logging(LOG_VERBOSE, "DPOFUA is set. Verify the DPO/FUA flags "
|
||||||
"are set in the CDB_USAGE_DATA");
|
"are set in the CDB_USAGE_DATA");
|
||||||
CU_ASSERT_EQUAL(rsoc->cdb_usage_data[1] & 0x18, 0x18);
|
CU_ASSERT_EQUAL(usage_data_dpofua, 0x18);
|
||||||
} else {
|
} else {
|
||||||
logging(LOG_VERBOSE, "DPOFUA is clear. Verify the DPO/FUA "
|
logging(LOG_VERBOSE, "DPOFUA is clear. Verify the DPO/FUA "
|
||||||
"flags are clear in the CDB_USAGE_DATA");
|
"flags are clear in the CDB_USAGE_DATA");
|
||||||
CU_ASSERT_EQUAL(rsoc->cdb_usage_data[1] & 0x18, 0x00);
|
CU_ASSERT_EQUAL(usage_data_dpofua, 0x00);
|
||||||
}
|
}
|
||||||
scsi_free_scsi_task(rso_task);
|
scsi_free_scsi_task(rso_task);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
void
|
void
|
||||||
test_write16_dpofua(void)
|
test_write16_dpofua(void)
|
||||||
{
|
{
|
||||||
int ret, dpofua;
|
int ret, dpofua, usage_data_dpofua;
|
||||||
struct scsi_task *ms_task = NULL;
|
struct scsi_task *ms_task = NULL;
|
||||||
struct scsi_mode_sense *ms;
|
struct scsi_mode_sense *ms;
|
||||||
struct scsi_task *rso_task = NULL;
|
struct scsi_task *rso_task = NULL;
|
||||||
@@ -48,7 +48,7 @@ test_write16_dpofua(void)
|
|||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
logging(LOG_VERBOSE, "[SUCCESS] Mode sense returned status GOOD");
|
logging(LOG_VERBOSE, "[SUCCESS] Mode sense returned status GOOD");
|
||||||
ms = scsi_datain_unmarshall(ms_task);
|
ms = scsi_datain_unmarshall(ms_task);
|
||||||
dpofua = !!(ms->device_specific_parameter & 0x10);
|
dpofua = ms && (ms->device_specific_parameter & 0x10);
|
||||||
scsi_free_scsi_task(ms_task);
|
scsi_free_scsi_task(ms_task);
|
||||||
|
|
||||||
if (dpofua) {
|
if (dpofua) {
|
||||||
@@ -125,14 +125,15 @@ test_write16_dpofua(void)
|
|||||||
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
|
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
|
||||||
rsoc = scsi_datain_unmarshall(rso_task);
|
rsoc = scsi_datain_unmarshall(rso_task);
|
||||||
CU_ASSERT_NOT_EQUAL(rsoc, NULL);
|
CU_ASSERT_NOT_EQUAL(rsoc, NULL);
|
||||||
|
usage_data_dpofua = rsoc ? rsoc->cdb_usage_data[1] & 0x18 : -1;
|
||||||
if (dpofua) {
|
if (dpofua) {
|
||||||
logging(LOG_VERBOSE, "DPOFUA is set. Verify the DPO/FUA flags "
|
logging(LOG_VERBOSE, "DPOFUA is set. Verify the DPO/FUA flags "
|
||||||
"are set in the CDB_USAGE_DATA");
|
"are set in the CDB_USAGE_DATA");
|
||||||
CU_ASSERT_EQUAL(rsoc->cdb_usage_data[1] & 0x18, 0x18);
|
CU_ASSERT_EQUAL(usage_data_dpofua, 0x18);
|
||||||
} else {
|
} else {
|
||||||
logging(LOG_VERBOSE, "DPOFUA is clear. Verify the DPO/FUA "
|
logging(LOG_VERBOSE, "DPOFUA is clear. Verify the DPO/FUA "
|
||||||
"flags are clear in the CDB_USAGE_DATA");
|
"flags are clear in the CDB_USAGE_DATA");
|
||||||
CU_ASSERT_EQUAL(rsoc->cdb_usage_data[1] & 0x18, 0x00);
|
CU_ASSERT_EQUAL(usage_data_dpofua, 0x00);
|
||||||
}
|
}
|
||||||
scsi_free_scsi_task(rso_task);
|
scsi_free_scsi_task(rso_task);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
void
|
void
|
||||||
test_writeverify10_dpo(void)
|
test_writeverify10_dpo(void)
|
||||||
{
|
{
|
||||||
int ret, dpofua;
|
int ret, dpofua, usage_data_dpo;
|
||||||
struct scsi_task *ms_task = NULL;
|
struct scsi_task *ms_task = NULL;
|
||||||
struct scsi_mode_sense *ms;
|
struct scsi_mode_sense *ms;
|
||||||
struct scsi_task *rso_task = NULL;
|
struct scsi_task *rso_task = NULL;
|
||||||
@@ -52,7 +52,7 @@ test_writeverify10_dpo(void)
|
|||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
logging(LOG_VERBOSE, "[SUCCESS] Mode sense returned status GOOD");
|
logging(LOG_VERBOSE, "[SUCCESS] Mode sense returned status GOOD");
|
||||||
ms = scsi_datain_unmarshall(ms_task);
|
ms = scsi_datain_unmarshall(ms_task);
|
||||||
dpofua = !!(ms->device_specific_parameter & 0x10);
|
dpofua = ms && (ms->device_specific_parameter & 0x10);
|
||||||
scsi_free_scsi_task(ms_task);
|
scsi_free_scsi_task(ms_task);
|
||||||
|
|
||||||
if (dpofua) {
|
if (dpofua) {
|
||||||
@@ -102,14 +102,15 @@ test_writeverify10_dpo(void)
|
|||||||
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
|
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
|
||||||
rsoc = scsi_datain_unmarshall(rso_task);
|
rsoc = scsi_datain_unmarshall(rso_task);
|
||||||
CU_ASSERT_NOT_EQUAL(rsoc, NULL);
|
CU_ASSERT_NOT_EQUAL(rsoc, NULL);
|
||||||
|
usage_data_dpo = rsoc ? rsoc->cdb_usage_data[1] & 0x10 : -1;
|
||||||
if (dpofua) {
|
if (dpofua) {
|
||||||
logging(LOG_VERBOSE, "DPOFUA is set. Verify the DPO flag "
|
logging(LOG_VERBOSE, "DPOFUA is set. Verify the DPO flag "
|
||||||
"is set in the CDB_USAGE_DATA");
|
"is set in the CDB_USAGE_DATA");
|
||||||
CU_ASSERT_EQUAL(rsoc->cdb_usage_data[1] & 0x10, 0x10);
|
CU_ASSERT_EQUAL(usage_data_dpo, 0x10);
|
||||||
} else {
|
} else {
|
||||||
logging(LOG_VERBOSE, "DPOFUA is clear. Verify the DPO "
|
logging(LOG_VERBOSE, "DPOFUA is clear. Verify the DPO "
|
||||||
"flag is clear in the CDB_USAGE_DATA");
|
"flag is clear in the CDB_USAGE_DATA");
|
||||||
CU_ASSERT_EQUAL(rsoc->cdb_usage_data[1] & 0x10, 0x00);
|
CU_ASSERT_EQUAL(usage_data_dpo, 0x00);
|
||||||
}
|
}
|
||||||
scsi_free_scsi_task(rso_task);
|
scsi_free_scsi_task(rso_task);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
void
|
void
|
||||||
test_writeverify12_dpo(void)
|
test_writeverify12_dpo(void)
|
||||||
{
|
{
|
||||||
int ret, dpofua;
|
int ret, dpofua, usage_data_dpo;
|
||||||
struct scsi_task *ms_task = NULL;
|
struct scsi_task *ms_task = NULL;
|
||||||
struct scsi_mode_sense *ms;
|
struct scsi_mode_sense *ms;
|
||||||
struct scsi_task *rso_task = NULL;
|
struct scsi_task *rso_task = NULL;
|
||||||
@@ -52,7 +52,7 @@ test_writeverify12_dpo(void)
|
|||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
logging(LOG_VERBOSE, "[SUCCESS] Mode sense returned status GOOD");
|
logging(LOG_VERBOSE, "[SUCCESS] Mode sense returned status GOOD");
|
||||||
ms = scsi_datain_unmarshall(ms_task);
|
ms = scsi_datain_unmarshall(ms_task);
|
||||||
dpofua = !!(ms->device_specific_parameter & 0x10);
|
dpofua = ms && (ms->device_specific_parameter & 0x10);
|
||||||
scsi_free_scsi_task(ms_task);
|
scsi_free_scsi_task(ms_task);
|
||||||
|
|
||||||
if (dpofua) {
|
if (dpofua) {
|
||||||
@@ -102,14 +102,15 @@ test_writeverify12_dpo(void)
|
|||||||
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
|
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
|
||||||
rsoc = scsi_datain_unmarshall(rso_task);
|
rsoc = scsi_datain_unmarshall(rso_task);
|
||||||
CU_ASSERT_NOT_EQUAL(rsoc, NULL);
|
CU_ASSERT_NOT_EQUAL(rsoc, NULL);
|
||||||
|
usage_data_dpo = rsoc ? rsoc->cdb_usage_data[1] & 0x10 : -1;
|
||||||
if (dpofua) {
|
if (dpofua) {
|
||||||
logging(LOG_VERBOSE, "DPOFUA is set. Verify the DPO flag "
|
logging(LOG_VERBOSE, "DPOFUA is set. Verify the DPO flag "
|
||||||
"is set in the CDB_USAGE_DATA");
|
"is set in the CDB_USAGE_DATA");
|
||||||
CU_ASSERT_EQUAL(rsoc->cdb_usage_data[1] & 0x10, 0x10);
|
CU_ASSERT_EQUAL(usage_data_dpo, 0x10);
|
||||||
} else {
|
} else {
|
||||||
logging(LOG_VERBOSE, "DPOFUA is clear. Verify the DPO "
|
logging(LOG_VERBOSE, "DPOFUA is clear. Verify the DPO "
|
||||||
"flag is clear in the CDB_USAGE_DATA");
|
"flag is clear in the CDB_USAGE_DATA");
|
||||||
CU_ASSERT_EQUAL(rsoc->cdb_usage_data[1] & 0x10, 0x00);
|
CU_ASSERT_EQUAL(usage_data_dpo, 0x00);
|
||||||
}
|
}
|
||||||
scsi_free_scsi_task(rso_task);
|
scsi_free_scsi_task(rso_task);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
void
|
void
|
||||||
test_writeverify16_dpo(void)
|
test_writeverify16_dpo(void)
|
||||||
{
|
{
|
||||||
int ret, dpofua;
|
int ret, dpofua, usage_data_dpo;
|
||||||
struct scsi_task *ms_task = NULL;
|
struct scsi_task *ms_task = NULL;
|
||||||
struct scsi_mode_sense *ms;
|
struct scsi_mode_sense *ms;
|
||||||
struct scsi_task *rso_task = NULL;
|
struct scsi_task *rso_task = NULL;
|
||||||
@@ -52,7 +52,7 @@ test_writeverify16_dpo(void)
|
|||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
logging(LOG_VERBOSE, "[SUCCESS] Mode sense returned status GOOD");
|
logging(LOG_VERBOSE, "[SUCCESS] Mode sense returned status GOOD");
|
||||||
ms = scsi_datain_unmarshall(ms_task);
|
ms = scsi_datain_unmarshall(ms_task);
|
||||||
dpofua = !!(ms->device_specific_parameter & 0x10);
|
dpofua = ms && (ms->device_specific_parameter & 0x10);
|
||||||
scsi_free_scsi_task(ms_task);
|
scsi_free_scsi_task(ms_task);
|
||||||
|
|
||||||
if (dpofua) {
|
if (dpofua) {
|
||||||
@@ -103,14 +103,15 @@ test_writeverify16_dpo(void)
|
|||||||
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
|
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
|
||||||
rsoc = scsi_datain_unmarshall(rso_task);
|
rsoc = scsi_datain_unmarshall(rso_task);
|
||||||
CU_ASSERT_NOT_EQUAL(rsoc, NULL);
|
CU_ASSERT_NOT_EQUAL(rsoc, NULL);
|
||||||
|
usage_data_dpo = rsoc ? rsoc->cdb_usage_data[1] & 0x10 : -1;
|
||||||
if (dpofua) {
|
if (dpofua) {
|
||||||
logging(LOG_VERBOSE, "DPOFUA is set. Verify the DPO flag "
|
logging(LOG_VERBOSE, "DPOFUA is set. Verify the DPO flag "
|
||||||
"is set in the CDB_USAGE_DATA");
|
"is set in the CDB_USAGE_DATA");
|
||||||
CU_ASSERT_EQUAL(rsoc->cdb_usage_data[1] & 0x10, 0x10);
|
CU_ASSERT_EQUAL(usage_data_dpo, 0x10);
|
||||||
} else {
|
} else {
|
||||||
logging(LOG_VERBOSE, "DPOFUA is clear. Verify the DPO "
|
logging(LOG_VERBOSE, "DPOFUA is clear. Verify the DPO "
|
||||||
"flag is clear in the CDB_USAGE_DATA");
|
"flag is clear in the CDB_USAGE_DATA");
|
||||||
CU_ASSERT_EQUAL(rsoc->cdb_usage_data[1] & 0x10, 0x00);
|
CU_ASSERT_EQUAL(usage_data_dpo, 0x00);
|
||||||
}
|
}
|
||||||
scsi_free_scsi_task(rso_task);
|
scsi_free_scsi_task(rso_task);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user