Skip to contentSkip to conversation

vhost/crypto: fix uninitialized variable

PATCH Applied Gowrishankar Muthukrishnan 2 participants 3 messages May 15, 2025 – May 16, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vhost/crypto: fix uninitialized variable

Fix uninitialized variable as reported in coverity scan.

Coverity-issue: 457449

Fixes d1b484bf187 ("vhost/crypto: support asymmetric RSA")
---
 lib/vhost/vhost_crypto.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/vhost/vhost_crypto.c +1 -1
index f78daf98d1..66ba5342e2 100644
@@ -1493,10 +1493,10 @@ vhost_crypto_process_one_req(struct vhost_crypto *vcrypto,
 	struct vhost_crypto_data_req *vc_req, *vc_req_out;
 	struct rte_cryptodev_asym_session *asym_session;
 	struct rte_cryptodev_sym_session *sym_session;
+	struct vhost_crypto_data_req data_req = {0};
 	struct vhost_crypto_session *vhost_session;
 	struct vhost_crypto_desc *desc = descs;
 	uint32_t nb_descs = 0, max_n_descs, i;
-	struct vhost_crypto_data_req data_req;
 	struct virtio_crypto_op_data_req req;
 	struct virtio_crypto_inhdr *inhdr;
 	struct vring_desc *src_desc;
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 16 lines · Gowrishankar Muthukrishnan

Fix uninitialized variable as reported in coverity scan.

Coverity-issue: 457449

Fixes d1b484bf187 ("vhost/crypto: support asymmetric RSA")
---
  lib/vhost/vhost_crypto.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
lib/vhost/vhost_crypto.c +0 -0
index f78daf98d1..66ba5342e2 100644
@@ -1493,10 +1493,10 @@ vhost_crypto_process_one_req(struct vhost_crypto *vcrypto,
  	struct vhost_crypto_data_req *vc_req, *vc_req_out;

lib/vhost/vhost_crypto.c vhost_crypto_process_one_req(struct vhost_crypto *vcrypto, · line 1502

Quoted 10 lines
lib/vhost/vhost_crypto.c +1 -1
  	struct rte_cryptodev_asym_session *asym_session;
  	struct rte_cryptodev_sym_session *sym_session;
+	struct vhost_crypto_data_req data_req = {0};
  	struct vhost_crypto_session *vhost_session;
  	struct vhost_crypto_desc *desc = descs;
  	uint32_t nb_descs = 0, max_n_descs, i;
-	struct vhost_crypto_data_req data_req;
  	struct virtio_crypto_op_data_req req;
  	struct virtio_crypto_inhdr *inhdr;
  	struct vring_desc *src_desc;

Thanks,
Maxime

#2 lore raw
In reply to Gowrishankar Muthukrishnan
Quoted 16 lines · Gowrishankar Muthukrishnan

Fix uninitialized variable as reported in coverity scan.

Coverity-issue: 457449

Fixes d1b484bf187 ("vhost/crypto: support asymmetric RSA")
---
  lib/vhost/vhost_crypto.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
lib/vhost/vhost_crypto.c +0 -0
index f78daf98d1..66ba5342e2 100644
@@ -1493,10 +1493,10 @@ vhost_crypto_process_one_req(struct vhost_crypto *vcrypto,
  	struct vhost_crypto_data_req *vc_req, *vc_req_out;

lib/vhost/vhost_crypto.c vhost_crypto_process_one_req(struct vhost_crypto *vcrypto, · line 1502

Quoted 10 lines
lib/vhost/vhost_crypto.c +1 -1
  	struct rte_cryptodev_asym_session *asym_session;
  	struct rte_cryptodev_sym_session *sym_session;
+	struct vhost_crypto_data_req data_req = {0};
  	struct vhost_crypto_session *vhost_session;
  	struct vhost_crypto_desc *desc = descs;
  	uint32_t nb_descs = 0, max_n_descs, i;
-	struct vhost_crypto_data_req data_req;
  	struct virtio_crypto_op_data_req req;
  	struct virtio_crypto_inhdr *inhdr;
  	struct vring_desc *src_desc;

Applied to next-virtio/for-net-next.

Thanks,
Maxime