test-tool: Fix a segmentation fault in test_receive_copy_results_op_params()

Do not access the RECEIVE_COPY_RESULTS() output if this operation
failed.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
This commit is contained in:
Bart Van Assche
2016-01-28 16:06:43 -08:00
parent 9df32565a6
commit 71c797fd1c
2 changed files with 8 additions and 5 deletions

View File

@@ -418,7 +418,7 @@ do { \
} while (0);
#define RECEIVE_COPY_RESULTS(...) \
do { \
({ \
int _r; \
_r = receive_copy_results(__VA_ARGS__); \
if (_r == -2) { \
@@ -429,7 +429,8 @@ do { \
return; \
} \
CU_ASSERT_EQUAL(_r, 0); \
} while (0);
_r; \
})
#define RELEASE6(...) \
do { \

View File

@@ -32,14 +32,16 @@ test_receive_copy_results_op_params(void)
{
struct scsi_task *op_task = NULL;
struct scsi_copy_results_op_params *opp;
int ret;
logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test RECEIVE COPY RESULTS, OPERATING PARAMS");
RECEIVE_COPY_RESULTS(&op_task, sd, SCSI_COPY_RESULTS_OP_PARAMS, 0,
(void **)&opp, EXPECT_STATUS_GOOD);
ret = RECEIVE_COPY_RESULTS(&op_task, sd, SCSI_COPY_RESULTS_OP_PARAMS, 0,
(void **)&opp, EXPECT_STATUS_GOOD);
logging(LOG_NORMAL,
if (ret == 0)
logging(LOG_NORMAL,
"max_target_desc=%d, max_seg_desc=%d",
opp->max_target_desc_count,
opp->max_segment_desc_count);