mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-15 04:40:05 +01:00
Fix problems found by Coverity scan.
This commit is contained in:
@@ -2110,22 +2110,17 @@ static int action_token(void)
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (action) {
|
if (action == ADD)
|
||||||
case ADD: /* adds only luks2-keyring type */
|
r = _token_add(cd); /* adds only luks2-keyring type */
|
||||||
r = _token_add(cd);
|
else if (action == REMOVE)
|
||||||
break;
|
|
||||||
case REMOVE:
|
|
||||||
r = _token_remove(cd);
|
r = _token_remove(cd);
|
||||||
break;
|
else if (action == IMPORT)
|
||||||
case IMPORT:
|
|
||||||
r = _token_import(cd);
|
r = _token_import(cd);
|
||||||
break;
|
else if (action == EXPORT)
|
||||||
case EXPORT:
|
|
||||||
r = _token_export(cd);
|
r = _token_export(cd);
|
||||||
break;
|
else {
|
||||||
default:
|
|
||||||
log_dbg("Internal token action error.");
|
log_dbg("Internal token action error.");
|
||||||
r = EINVAL;
|
r = -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
crypt_free(cd);
|
crypt_free(cd);
|
||||||
|
|||||||
@@ -640,7 +640,7 @@ int tools_read_json_file(struct crypt_device *cd, const char *file, char **json,
|
|||||||
out:
|
out:
|
||||||
if (block && !quit)
|
if (block && !quit)
|
||||||
set_int_block(1);
|
set_int_block(1);
|
||||||
if (fd != STDIN_FILENO)
|
if (fd >= 0 && fd != STDIN_FILENO)
|
||||||
close(fd);
|
close(fd);
|
||||||
if (r && buf) {
|
if (r && buf) {
|
||||||
memset(buf, 0, LUKS2_MAX_MDA_SIZE);
|
memset(buf, 0, LUKS2_MAX_MDA_SIZE);
|
||||||
@@ -694,7 +694,7 @@ int tools_write_json_file(struct crypt_device *cd, const char *file, const char
|
|||||||
out:
|
out:
|
||||||
if (block && !quit)
|
if (block && !quit)
|
||||||
set_int_block(1);
|
set_int_block(1);
|
||||||
if (fd != STDOUT_FILENO)
|
if (fd >=0 && fd != STDOUT_FILENO)
|
||||||
close(fd);
|
close(fd);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user