Skip to contentSkip to conversation

hw/xen: Avoid Avoid use of uninitialized bufioreq_evtchn

PATCH In review Edgar E. Iglesias 2 participants 3 messages Oct 7, 2024

lore
Share & tools
lore
#0 lore raw

cover hw/xen: Avoid Avoid use of uninitialized bufioreq_evtchn

From: "Edgar E. Iglesias" <[email protected]>

This has a fix for Coverity CID 1563383 reported by Peter.

Avoid use of uninitialized bufioreq_evtchn. It should only be used if buffered IOREQs are enabled.

Cheers,
Edgar

Edgar E. Iglesias (1):
hw/xen: Avoid use of uninitialized bufioreq_evtchn

 hw/xen/xen-hvm-common.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
Signature · 1 line
2.43.0
#1 lore raw

PATCH 1/1 hw/xen: Avoid use of uninitialized bufioreq_evtchn

From: "Edgar E. Iglesias" <[email protected]>

Avoid use of uninitialized bufioreq_evtchn. It should only be used if buffered IOREQs are enabled.

Resolves: Coverity CID 1563383

---
 hw/xen/xen-hvm-common.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
hw/xen/xen-hvm-common.c +4 -3
index 7d2b72853b..7ffbbfea23 100644
@@ -752,9 +752,10 @@ static int xen_map_ioreq_server(XenIOState *state)
         return -1;
     }
 
-    trace_xen_map_ioreq_server_buffered_io_evtchn(bufioreq_evtchn);
-
-    state->bufioreq_remote_port = bufioreq_evtchn;
+    if (state->has_bufioreq) {
+        trace_xen_map_ioreq_server_buffered_io_evtchn(bufioreq_evtchn);
+        state->bufioreq_remote_port = bufioreq_evtchn;
+    }
 
     return 0;
 }
Signature · 1 line
2.43.0
Acked-by on v1 1/1
#2 lore raw

Re: [PATCH v1 1/1] hw/xen: Avoid use of uninitialized bufioreq_evtchn

Quoted 8 lines · Edgar E. Iglesias

From: "Edgar E. Iglesias" <[email protected]>

Avoid use of uninitialized bufioreq_evtchn. It should only be used if buffered IOREQs are enabled.

Resolves: Coverity CID 1563383

Quoted 25 lines
---
 hw/xen/xen-hvm-common.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
hw/xen/xen-hvm-common.c +4 -3
index 7d2b72853b..7ffbbfea23 100644
@@ -752,9 +752,10 @@ static int xen_map_ioreq_server(XenIOState *state)
         return -1;
     }
 
-    trace_xen_map_ioreq_server_buffered_io_evtchn(bufioreq_evtchn);
-
-    state->bufioreq_remote_port = bufioreq_evtchn;
+    if (state->has_bufioreq) {
+        trace_xen_map_ioreq_server_buffered_io_evtchn(bufioreq_evtchn);
+        state->bufioreq_remote_port = bufioreq_evtchn;
+    }
 
     return 0;
 }
Signature · 1 line
2.43.0