qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

cryptodev: Fix cryptodev_builtin_cleanup() error API violation

The Error ** argument must be NULL, &error_abort, &error_fatal, or a
pointer to a variable containing NULL. Passing an argument of the
latter kind twice without clearing it in between is wrong: if the
first call sets an error, it no longer points to NULL for the second
call.

cryptodev_builtin_cleanup() passes @errp to
cryptodev_builtin_sym_close_session() in a loop. Harmless, because
cryptodev_builtin_sym_close_session() can't actually fail. Fix it
anyway.

Cc: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20200422130719.28225-2-armbru@redhat.com>

+2 -8
+2 -8
backends/cryptodev-builtin.c
··· 282 282 CryptoDevBackendBuiltin *builtin = 283 283 CRYPTODEV_BACKEND_BUILTIN(backend); 284 284 285 - if (session_id >= MAX_NUM_SESSIONS || 286 - builtin->sessions[session_id] == NULL) { 287 - error_setg(errp, "Cannot find a valid session id: %" PRIu64 "", 288 - session_id); 289 - return -1; 290 - } 285 + assert(session_id < MAX_NUM_SESSIONS && builtin->sessions[session_id]); 291 286 292 287 qcrypto_cipher_free(builtin->sessions[session_id]->cipher); 293 288 g_free(builtin->sessions[session_id]); ··· 356 351 357 352 for (i = 0; i < MAX_NUM_SESSIONS; i++) { 358 353 if (builtin->sessions[i] != NULL) { 359 - cryptodev_builtin_sym_close_session( 360 - backend, i, 0, errp); 354 + cryptodev_builtin_sym_close_session(backend, i, 0, &error_abort); 361 355 } 362 356 } 363 357