summaryrefslogtreecommitdiffstats
path: root/backends
diff options
context:
space:
mode:
Diffstat (limited to 'backends')
-rw-r--r--backends/cryptodev-builtin.c12
-rw-r--r--backends/hostmem.c22
2 files changed, 14 insertions, 20 deletions
diff --git a/backends/cryptodev-builtin.c b/backends/cryptodev-builtin.c
index 82a068e792..657c0ba2f3 100644
--- a/backends/cryptodev-builtin.c
+++ b/backends/cryptodev-builtin.c
@@ -320,10 +320,12 @@ static int cryptodev_builtin_sym_operation(
sess = builtin->sessions[op_info->session_id];
- ret = qcrypto_cipher_setiv(sess->cipher, op_info->iv,
- op_info->iv_len, errp);
- if (ret < 0) {
- return -VIRTIO_CRYPTO_ERR;
+ if (op_info->iv_len > 0) {
+ ret = qcrypto_cipher_setiv(sess->cipher, op_info->iv,
+ op_info->iv_len, errp);
+ if (ret < 0) {
+ return -VIRTIO_CRYPTO_ERR;
+ }
}
if (sess->direction == VIRTIO_CRYPTO_OP_ENCRYPT) {
@@ -359,8 +361,6 @@ static void cryptodev_builtin_cleanup(
}
}
- assert(queues == 1);
-
for (i = 0; i < queues; i++) {
cc = backend->conf.peers.ccs[i];
if (cc) {
diff --git a/backends/hostmem.c b/backends/hostmem.c
index 162c2187d8..89feb9ed75 100644
--- a/backends/hostmem.c
+++ b/backends/hostmem.c
@@ -64,14 +64,6 @@ out:
error_propagate(errp, local_err);
}
-static uint16List **host_memory_append_node(uint16List **node,
- unsigned long value)
-{
- *node = g_malloc0(sizeof(**node));
- (*node)->value = value;
- return &(*node)->next;
-}
-
static void
host_memory_backend_get_host_nodes(Object *obj, Visitor *v, const char *name,
void *opaque, Error **errp)
@@ -82,23 +74,25 @@ host_memory_backend_get_host_nodes(Object *obj, Visitor *v, const char *name,
unsigned long value;
value = find_first_bit(backend->host_nodes, MAX_NODES);
-
- node = host_memory_append_node(node, value);
-
if (value == MAX_NODES) {
- goto out;
+ return;
}
+ *node = g_malloc0(sizeof(**node));
+ (*node)->value = value;
+ node = &(*node)->next;
+
do {
value = find_next_bit(backend->host_nodes, MAX_NODES, value + 1);
if (value == MAX_NODES) {
break;
}
- node = host_memory_append_node(node, value);
+ *node = g_malloc0(sizeof(**node));
+ (*node)->value = value;
+ node = &(*node)->next;
} while (true);
-out:
visit_type_uint16List(v, name, &host_nodes, errp);
}