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:
Milan Broz
2022-04-18 10:18:18 +02:00
parent 2857e10083
commit f1eea3a4b3
2 changed files with 6 additions and 0 deletions

View File

@@ -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;