diff mbox series

accel/kvm/kvm-all: Fixes the missing break in vCPU unpark logic

Message ID 20240725145132.99355-1-salil.mehta@huawei.com (mailing list archive)
State New, archived
Headers show
Series accel/kvm/kvm-all: Fixes the missing break in vCPU unpark logic | expand

Commit Message

Salil Mehta July 25, 2024, 2:51 p.m. UTC
Loop should exit prematurely on successfully finding out the parked vCPU (struct
KVMParkedVcpu) in the 'struct KVMState' maintained 'kvm_parked_vcpus' list of
parked vCPUs.

Fixes: Coverity CID 1558552
Fixes: 08c3286822 ("accel/kvm: Extract common KVM vCPU {creation,parking} code")
Reported-by: Peter Maydell <peter.maydell@linaro.org>
Suggested-by: Peter Maydell <peter.maydell@linaro.org>
Message-ID: <CAFEAcA-3_d1c7XSXWkFubD-LsW5c5i95e6xxV09r2C9yGtzcdA@mail.gmail.com>
Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
---
 accel/kvm/kvm-all.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Philippe Mathieu-Daudé July 25, 2024, 7:57 p.m. UTC | #1
On 25/7/24 16:51, Salil Mehta wrote:
> Loop should exit prematurely on successfully finding out the parked vCPU (struct
> KVMParkedVcpu) in the 'struct KVMState' maintained 'kvm_parked_vcpus' list of
> parked vCPUs.
> 
> Fixes: Coverity CID 1558552
> Fixes: 08c3286822 ("accel/kvm: Extract common KVM vCPU {creation,parking} code")
> Reported-by: Peter Maydell <peter.maydell@linaro.org>
> Suggested-by: Peter Maydell <peter.maydell@linaro.org>
> Message-ID: <CAFEAcA-3_d1c7XSXWkFubD-LsW5c5i95e6xxV09r2C9yGtzcdA@mail.gmail.com>
> Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
> ---
>   accel/kvm/kvm-all.c | 1 +
>   1 file changed, 1 insertion(+)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Gavin Shan July 26, 2024, 12:27 a.m. UTC | #2
On 7/26/24 12:51 AM, Salil Mehta wrote:
> Loop should exit prematurely on successfully finding out the parked vCPU (struct
> KVMParkedVcpu) in the 'struct KVMState' maintained 'kvm_parked_vcpus' list of
> parked vCPUs.
> 
> Fixes: Coverity CID 1558552
> Fixes: 08c3286822 ("accel/kvm: Extract common KVM vCPU {creation,parking} code")
> Reported-by: Peter Maydell <peter.maydell@linaro.org>
> Suggested-by: Peter Maydell <peter.maydell@linaro.org>
> Message-ID: <CAFEAcA-3_d1c7XSXWkFubD-LsW5c5i95e6xxV09r2C9yGtzcdA@mail.gmail.com>
> Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
> ---
>   accel/kvm/kvm-all.c | 1 +
>   1 file changed, 1 insertion(+)
> 

Reviewed-by: Gavin Shan <gshan@redhat.com>
Zhao Liu July 26, 2024, 8:47 a.m. UTC | #3
On Thu, Jul 25, 2024 at 03:51:32PM +0100, Salil Mehta via wrote:
> Date: Thu, 25 Jul 2024 15:51:32 +0100
> From: Salil Mehta via <qemu-devel@nongnu.org>
> Subject: [PATCH] accel/kvm/kvm-all: Fixes the missing break in vCPU unpark
>  logic
> X-Mailer: git-send-email 2.34.1
> 
> Loop should exit prematurely on successfully finding out the parked vCPU (struct
> KVMParkedVcpu) in the 'struct KVMState' maintained 'kvm_parked_vcpus' list of
> parked vCPUs.
> 
> Fixes: Coverity CID 1558552
> Fixes: 08c3286822 ("accel/kvm: Extract common KVM vCPU {creation,parking} code")
> Reported-by: Peter Maydell <peter.maydell@linaro.org>
> Suggested-by: Peter Maydell <peter.maydell@linaro.org>
> Message-ID: <CAFEAcA-3_d1c7XSXWkFubD-LsW5c5i95e6xxV09r2C9yGtzcdA@mail.gmail.com>
> Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
> ---
>  accel/kvm/kvm-all.c | 1 +
>  1 file changed, 1 insertion(+)

Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
Igor Mammedov July 26, 2024, 9:33 a.m. UTC | #4
On Thu, 25 Jul 2024 15:51:32 +0100
Salil Mehta <salil.mehta@huawei.com> wrote:

> Loop should exit prematurely on successfully finding out the parked vCPU (struct
> KVMParkedVcpu) in the 'struct KVMState' maintained 'kvm_parked_vcpus' list of
> parked vCPUs.
> 
> Fixes: Coverity CID 1558552
> Fixes: 08c3286822 ("accel/kvm: Extract common KVM vCPU {creation,parking} code")
> Reported-by: Peter Maydell <peter.maydell@linaro.org>
> Suggested-by: Peter Maydell <peter.maydell@linaro.org>
> Message-ID: <CAFEAcA-3_d1c7XSXWkFubD-LsW5c5i95e6xxV09r2C9yGtzcdA@mail.gmail.com>
> Signed-off-by: Salil Mehta <salil.mehta@huawei.com>

Reviewed-by: Igor Mammedov <imammedo@redhat.com>

> ---
>  accel/kvm/kvm-all.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
> index 0aa4b4624a..c181297f00 100644
> --- a/accel/kvm/kvm-all.c
> +++ b/accel/kvm/kvm-all.c
> @@ -362,6 +362,7 @@ int kvm_unpark_vcpu(KVMState *s, unsigned long vcpu_id)
>              QLIST_REMOVE(cpu, node);
>              kvm_fd = cpu->kvm_fd;
>              g_free(cpu);
> +            break;
>          }
>      }
>
Salil Mehta July 31, 2024, 8:48 a.m. UTC | #5
Hello,

A quick check and a gentle reminder, has this patch been accepted?

Best regards
Salil.

>  From: Igor Mammedov <imammedo@redhat.com>
>  Sent: Friday, July 26, 2024 10:34 AM
>  To: Salil Mehta <salil.mehta@huawei.com>
>  
>  On Thu, 25 Jul 2024 15:51:32 +0100
>  Salil Mehta <salil.mehta@huawei.com> wrote:
>  
>  > Loop should exit prematurely on successfully finding out the parked
>  > vCPU (struct
>  > KVMParkedVcpu) in the 'struct KVMState' maintained
>  'kvm_parked_vcpus'
>  > list of parked vCPUs.
>  >
>  > Fixes: Coverity CID 1558552
>  > Fixes: 08c3286822 ("accel/kvm: Extract common KVM vCPU
>  > {creation,parking} code")
>  > Reported-by: Peter Maydell <peter.maydell@linaro.org>
>  > Suggested-by: Peter Maydell <peter.maydell@linaro.org>
>  > Message-ID:
>  > <CAFEAcA-3_d1c7XSXWkFubD-
>  LsW5c5i95e6xxV09r2C9yGtzcdA@mail.gmail.com>
>  > Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
>  
>  Reviewed-by: Igor Mammedov <imammedo@redhat.com>
>  
>  > ---
>  >  accel/kvm/kvm-all.c | 1 +
>  >  1 file changed, 1 insertion(+)
>  >
>  > diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index
>  > 0aa4b4624a..c181297f00 100644
>  > --- a/accel/kvm/kvm-all.c
>  > +++ b/accel/kvm/kvm-all.c
>  > @@ -362,6 +362,7 @@ int kvm_unpark_vcpu(KVMState *s, unsigned long
>  vcpu_id)
>  >              QLIST_REMOVE(cpu, node);
>  >              kvm_fd = cpu->kvm_fd;
>  >              g_free(cpu);
>  > +            break;
>  >          }
>  >      }
>  >
>
Peter Maydell July 31, 2024, 11:39 a.m. UTC | #6
On Wed, 31 Jul 2024 at 09:49, Salil Mehta <salil.mehta@huawei.com> wrote:
>
> Hello,
>
> A quick check and a gentle reminder, has this patch been accepted?

Thanks for the ping. I'm doing a target-arm pullreq tomorrow
so I'll take it via my queue.

-- PMM
Salil Mehta July 31, 2024, 12:32 p.m. UTC | #7
>  From: Peter Maydell <peter.maydell@linaro.org>
>  Sent: Wednesday, July 31, 2024 12:39 PM
>  To: Salil Mehta <salil.mehta@huawei.com>
>  
>  On Wed, 31 Jul 2024 at 09:49, Salil Mehta <salil.mehta@huawei.com> wrote:
>  >
>  > Hello,
>  >
>  > A quick check and a gentle reminder, has this patch been accepted?
>  
>  Thanks for the ping. I'm doing a target-arm pullreq tomorrow so I'll take it via
>  my queue.

Great. Thanks!

Best regards
Salil.

>  
>  -- PMM
diff mbox series

Patch

diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
index 0aa4b4624a..c181297f00 100644
--- a/accel/kvm/kvm-all.c
+++ b/accel/kvm/kvm-all.c
@@ -362,6 +362,7 @@  int kvm_unpark_vcpu(KVMState *s, unsigned long vcpu_id)
             QLIST_REMOVE(cpu, node);
             kvm_fd = cpu->kvm_fd;
             g_free(cpu);
+            break;
         }
     }