mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-06 00:10:04 +01:00
Clean reencrypt status struct for API call.
This function should not return unitialized struct as there is no indication that it failed and caller can access it. Also fixes a Coverity warning.
This commit is contained in:
@@ -3718,6 +3718,9 @@ crypt_reencrypt_info LUKS2_reencrypt_get_params(struct luks2_hdr *hdr,
|
||||
int digest;
|
||||
uint32_t version;
|
||||
|
||||
if (params)
|
||||
memset(params, 0, sizeof(*params));
|
||||
|
||||
ri = LUKS2_reencrypt_status(hdr);
|
||||
if (ri == CRYPT_REENCRYPT_NONE || ri == CRYPT_REENCRYPT_INVALID || !params)
|
||||
return ri;
|
||||
|
||||
@@ -6387,6 +6387,9 @@ void crypt_serialize_unlock(struct crypt_device *cd)
|
||||
crypt_reencrypt_info crypt_reencrypt_status(struct crypt_device *cd,
|
||||
struct crypt_params_reencrypt *params)
|
||||
{
|
||||
if (params)
|
||||
memset(params, 0, sizeof(*params));
|
||||
|
||||
if (!cd || !isLUKS2(cd->type))
|
||||
return CRYPT_REENCRYPT_NONE;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user