test-tool/test_prin_read_keys_truncate: Do not crash if PERSISTENT RESERVE IN fails
Do not try to dereference the 'rk' pointer if it is NULL. Signed-off-by: Bart Van Assche <bvanassche@acm.org>
This commit is contained in:
@@ -58,15 +58,17 @@ test_prin_read_keys_truncate(void)
|
|||||||
}
|
}
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
|
|
||||||
/*
|
if (rk) {
|
||||||
* SPC5r17: 6.16.2 READ KEYS service action
|
/*
|
||||||
* The ADDITIONAL LENGTH field indicates the number of bytes in
|
* SPC5r17: 6.16.2 READ KEYS service action
|
||||||
* the Reservation key list. The contents of the ADDITIONAL
|
* The ADDITIONAL LENGTH field indicates the number of bytes in
|
||||||
* LENGTH field are not altered based on the allocation length.
|
* the Reservation key list. The contents of the ADDITIONAL
|
||||||
*/
|
* LENGTH field are not altered based on the allocation length.
|
||||||
CU_ASSERT_NOT_EQUAL(rk->additional_length, 0);
|
*/
|
||||||
/* key array should have been truncated in the response */
|
CU_ASSERT_NOT_EQUAL(rk->additional_length, 0);
|
||||||
CU_ASSERT_EQUAL(rk->num_keys, 0);
|
/* key array should have been truncated in the response */
|
||||||
|
CU_ASSERT_EQUAL(rk->num_keys, 0);
|
||||||
|
}
|
||||||
|
|
||||||
/* remove our key from the target */
|
/* remove our key from the target */
|
||||||
ret = prout_register_key(sd, 0, key);
|
ret = prout_register_key(sd, 0, key);
|
||||||
|
|||||||
Reference in New Issue
Block a user