Skip to contentSkip to conversation

net/virtio-user: fix uninitialized variable

PATCH Applied Chenbo Xia 3 participants 3 messages Jul 14, 2020 – Jul 16, 2020 Network drivers

lore
Share & tools
lore

Chenbo Xia

author
#0 lore raw

PATCH 1/1 net/virtio-user: fix uninitialized variable

This patch fixes an issue that uninitialized has_reply_ack is used for setting message flags.

Coverity issue: 360834

Fixes c60208dd6384 ("net/virtio-user: support reply-ack")
---
 drivers/net/virtio/virtio_user/vhost_user.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/virtio/virtio_user/vhost_user.c +1 -1
index 631d0e353..ad48bafd4 100644
@@ -254,7 +254,7 @@ vhost_user_sock(struct virtio_user_dev *dev,
 	struct vhost_user_msg msg;
 	struct vhost_vring_file *file = 0;
 	int need_reply = 0;
-	int has_reply_ack;
+	int has_reply_ack = 0;
 	int fds[VHOST_MEMORY_MAX_NREGIONS];
 	int fd_num = 0;
 	int len;
Signature · 1 line
2.17.1
Acked-by on v1 1/1
#1 lore raw
Quoted 17 lines · Chenbo Xia

This patch fixes an issue that uninitialized has_reply_ack is used for setting message flags.

Coverity issue: 360834

Fixes c60208dd6384 ("net/virtio-user: support reply-ack")
---
 drivers/net/virtio/virtio_user/vhost_user.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/virtio/virtio_user/vhost_user.c +0 -0
index 631d0e353..ad48bafd4 100644

drivers/net/virtio/virtio_user/vhost_user.c vhost_user_sock(struct virtio_user_dev *dev, · line 260

Quoted 8 lines
drivers/net/virtio/virtio_user/vhost_user.c +1 -1
@@ -254,7 +254,7 @@ vhost_user_sock(struct virtio_user_dev *dev,
 	struct vhost_user_msg msg;
 	struct vhost_vring_file *file = 0;
 	int need_reply = 0;
-	int has_reply_ack;
+	int has_reply_ack = 0;
 	int fds[VHOST_MEMORY_MAX_NREGIONS];
 	int fd_num = 0;
 	int len;
Signature · 1 line
Adrián Moreno
Applied
#2 lore raw
Quoted 13 lines · Adrian Moreno
Quoted 11 lines · Chenbo Xia

This patch fixes an issue that uninitialized has_reply_ack is used for setting message flags.

Coverity issue: 360834

Fixes c60208dd6384 ("net/virtio-user: support reply-ack")
---
 drivers/net/virtio/virtio_user/vhost_user.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 17 lines
Quoted 6 lines
drivers/net/virtio/virtio_user/vhost_user.c +0 -0
index 631d0e353..ad48bafd4 100644

drivers/net/virtio/virtio_user/vhost_user.c vhost_user_sock(struct virtio_user_dev *dev, · line 260

Quoted 8 lines
drivers/net/virtio/virtio_user/vhost_user.c +1 -1
@@ -254,7 +254,7 @@ vhost_user_sock(struct virtio_user_dev *dev,
 	struct vhost_user_msg msg;
 	struct vhost_vring_file *file = 0;
 	int need_reply = 0;
-	int has_reply_ack;
+	int has_reply_ack = 0;
 	int fds[VHOST_MEMORY_MAX_NREGIONS];
 	int fd_num = 0;
 	int len;

Applied to dpdk-next-net/master, thanks.