diff mbox series

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

Message ID 20241007211643.1572271-2-edgar.iglesias@gmail.com (mailing list archive)
State New, archived
Headers show
Series hw/xen: Avoid Avoid use of uninitialized bufioreq_evtchn | expand

Commit Message

Edgar E. Iglesias Oct. 7, 2024, 9:16 p.m. UTC
From: "Edgar E. Iglesias" <edgar.iglesias@amd.com>

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

Resolves: Coverity CID 1563383
Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@amd.com>
---
 hw/xen/xen-hvm-common.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Stefano Stabellini Oct. 7, 2024, 9:38 p.m. UTC | #1
On Mon, 7 Oct 2024, Edgar E. Iglesias wrote:
> From: "Edgar E. Iglesias" <edgar.iglesias@amd.com>
> 
> Avoid use of uninitialized bufioreq_evtchn. It should only
> be used if buffered IOREQs are enabled.
> 
> Resolves: Coverity CID 1563383
> Reported-by: Peter Maydell <peter.maydell@linaro.org>
> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@amd.com>

Acked-by: Stefano Stabellini <sstabellini@kernel.org>


> ---
>  hw/xen/xen-hvm-common.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/hw/xen/xen-hvm-common.c b/hw/xen/xen-hvm-common.c
> index 7d2b72853b..7ffbbfea23 100644
> --- a/hw/xen/xen-hvm-common.c
> +++ b/hw/xen/xen-hvm-common.c
> @@ -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;
>  }
> -- 
> 2.43.0
>
diff mbox series

Patch

diff --git a/hw/xen/xen-hvm-common.c b/hw/xen/xen-hvm-common.c
index 7d2b72853b..7ffbbfea23 100644
--- a/hw/xen/xen-hvm-common.c
+++ b/hw/xen/xen-hvm-common.c
@@ -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;
 }