[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 11/32] cryptodev: Fix cryptodev_builtin_cleanup() error API violat
From: |
Markus Armbruster |
Subject: |
[PULL 11/32] cryptodev: Fix cryptodev_builtin_cleanup() error API violation |
Date: |
Wed, 29 Apr 2020 09:20:27 +0200 |
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 <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>
Message-Id: <address@hidden>
---
backends/cryptodev-builtin.c | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/backends/cryptodev-builtin.c b/backends/cryptodev-builtin.c
index c8ae3b9742..14316333fe 100644
--- a/backends/cryptodev-builtin.c
+++ b/backends/cryptodev-builtin.c
@@ -282,12 +282,7 @@ static int cryptodev_builtin_sym_close_session(
CryptoDevBackendBuiltin *builtin =
CRYPTODEV_BACKEND_BUILTIN(backend);
- if (session_id >= MAX_NUM_SESSIONS ||
- builtin->sessions[session_id] == NULL) {
- error_setg(errp, "Cannot find a valid session id: %" PRIu64 "",
- session_id);
- return -1;
- }
+ assert(session_id < MAX_NUM_SESSIONS && builtin->sessions[session_id]);
qcrypto_cipher_free(builtin->sessions[session_id]->cipher);
g_free(builtin->sessions[session_id]);
@@ -356,8 +351,7 @@ static void cryptodev_builtin_cleanup(
for (i = 0; i < MAX_NUM_SESSIONS; i++) {
if (builtin->sessions[i] != NULL) {
- cryptodev_builtin_sym_close_session(
- backend, i, 0, errp);
+ cryptodev_builtin_sym_close_session(backend, i, 0, &error_abort);
}
}
--
2.21.1
- [PULL 31/32] libqos: Give get_machine_allocator() internal linkage, (continued)
- [PULL 31/32] libqos: Give get_machine_allocator() internal linkage, Markus Armbruster, 2020/04/29
- [PULL 07/32] qemu-option: Avoid has_help_option() in qemu_opts_parse_noisily(), Markus Armbruster, 2020/04/29
- [PULL 19/32] xen/pt: Fix flawed conversion to realize(), Markus Armbruster, 2020/04/29
- [PULL 32/32] qemu-option: pass NULL rather than 0 to the id of qemu_opts_set(), Markus Armbruster, 2020/04/29
- [PULL 08/32] qemu-img: Factor out accumulate_options() helper, Markus Armbruster, 2020/04/29
- [PULL 24/32] qga: Fix qmp_guest_suspend_{disk, ram}() error handling, Markus Armbruster, 2020/04/29
- [PULL 25/32] sam460ex: Suppress useless warning on -m 32 and -m 64, Markus Armbruster, 2020/04/29
- [PULL 27/32] bamboo, sam460ex: Tidy up error message for unsupported RAM size, Markus Armbruster, 2020/04/29
- [PULL 16/32] fdc: Fix fallback=auto error handling, Markus Armbruster, 2020/04/29
- [PULL 28/32] smbus: Fix spd_data_generate() for number of banks > 2, Markus Armbruster, 2020/04/29
- [PULL 11/32] cryptodev: Fix cryptodev_builtin_cleanup() error API violation,
Markus Armbruster <=
- [PULL 01/32] various: Remove suspicious '\' character outside of #define in C code, Markus Armbruster, 2020/04/29
- [PULL 26/32] smbus: Fix spd_data_generate() error API violation, Markus Armbruster, 2020/04/29
- [PULL 17/32] bochs-display: Fix vgamem=SIZE error handling, Markus Armbruster, 2020/04/29
- [PULL 23/32] qga: Fix qmp_guest_get_memory_blocks() error handling, Markus Armbruster, 2020/04/29
- [PULL 30/32] fuzz: Simplify how we compute available machines and types, Markus Armbruster, 2020/04/29
- [PULL 15/32] arm/virt: Fix virt_machine_device_plug_cb() error API violation, Markus Armbruster, 2020/04/29
- [PULL 29/32] Makefile: Drop unused, broken target recurse-fuzz, Markus Armbruster, 2020/04/29
- [PULL 21/32] migration/colo: Fix qmp_xen_colo_do_checkpoint() error handling, Markus Armbruster, 2020/04/29
- [PULL 13/32] cpus: Fix configure_icount() error API violation, Markus Armbruster, 2020/04/29
- [PULL 12/32] block/file-posix: Fix check_cache_dropped() error handling, Markus Armbruster, 2020/04/29