On Tue 25 Apr 2017 05:38:51 PM CEST, Daniel P. Berrange wrote:
> + switch (s->crypt_method_header) {
> + case QCOW_CRYPT_NONE:
> + if (encryptfmt) {
> + error_setg(errp, "No encryption in image header, but options "
> + "specified format '%s'", encryptfmt);
> + goto fail;
> + }
> + break;
You forgot to set the return value here (it is undefined at this
point)...
> +
> + case QCOW_CRYPT_AES:
> + if (encryptfmt && !g_str_equal(encryptfmt, "aes")) {
> + error_setg(errp,
> + "Header reported 'aes' encryption format but "
> + "options specify '%s'", encryptfmt);
> + ret = -EINVAL;
> + goto fail;
> + }
...and here you could break instead, the condition immediately after the
switch sets ret to -EINVAL and returns.
> +##
> +# @BlockdevQcow2EncryptionFormat:
> +# @qcow: AES-CBC with plain64 initialization venctors
> +#
> +# Since: 2.10
> +##
> +{ 'enum': 'BlockdevQcow2EncryptionFormat',
> + 'data': [ 'qcow' ] }
> +
Same question here, isn't this supposed to be 'aes' ?
Berto