mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-05 16:00:05 +01:00
Fix some scan build warnings for api-test-2.
This commit is contained in:
@@ -199,6 +199,11 @@ static int get_luks2_offsets(int metadata_device,
|
||||
struct crypt_device *cd = NULL;
|
||||
static uint64_t default_header_size = 0;
|
||||
|
||||
if (r_header_size)
|
||||
*r_header_size = 0;
|
||||
if (r_payload_offset)
|
||||
*r_payload_offset = 0;
|
||||
|
||||
if (!default_header_size) {
|
||||
if (crypt_init(&cd, THE_LOOP_DEV))
|
||||
return -EINVAL;
|
||||
@@ -966,8 +971,7 @@ static void AddDeviceLuks2(void)
|
||||
OK_(!(global_lines != 0));
|
||||
reset_log();
|
||||
OK_(crypt_dump_json(cd, &tmp_buf, 0));
|
||||
OK_(!tmp_buf);
|
||||
OK_(!(strlen(tmp_buf) != 0));
|
||||
OK_(!(tmp_buf && strlen(tmp_buf) != 0));
|
||||
|
||||
FAIL_(crypt_set_uuid(cd, "blah"), "wrong UUID format");
|
||||
OK_(crypt_set_uuid(cd, DEVICE_TEST_UUID));
|
||||
|
||||
@@ -214,7 +214,6 @@ int get_key_dm(const char *name, char *buffer, unsigned int buffer_size)
|
||||
struct dm_info dmi;
|
||||
uint64_t start, length;
|
||||
char *target_type, *key, *params;
|
||||
void *next = NULL;
|
||||
int r = -EINVAL;
|
||||
|
||||
if (!(dmt = dm_task_create(DM_DEVICE_TABLE)))
|
||||
@@ -228,7 +227,7 @@ int get_key_dm(const char *name, char *buffer, unsigned int buffer_size)
|
||||
if (!dmi.exists)
|
||||
goto out;
|
||||
|
||||
next = dm_get_next_target(dmt, next, &start, &length, &target_type, ¶ms);
|
||||
dm_get_next_target(dmt, NULL, &start, &length, &target_type, ¶ms);
|
||||
if (!target_type || strcmp(target_type, "crypt") != 0)
|
||||
goto out;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user