[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAL715WJFJLtVy_pooEVzsteEq35Wqa9LDFc_gfRjMEm0McfB-w@mail.gmail.com>
Date: Tue, 7 Mar 2023 08:35:56 -0800
From: Mingwei Zhang <mizhang@...gle.com>
To: Wei Wang <wei.w.wang@...el.com>
Cc: seanjc@...gle.com, dmatlack@...gle.com, isaku.yamahata@...il.com,
pbonzini@...hat.com, kvm@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] KVM: allow KVM_BUG/KVM_BUG_ON to handle 64-bit cond
On Tue, Mar 7, 2023 at 5:52 AM Wei Wang <wei.w.wang@...el.com> wrote:
>
> Current KVM_BUG and KVM_BUG_ON assume that 'cond' passed from callers is
> 32-bit as it casts 'cond' to the type of int. This will be wrong if 'cond'
> provided by a caller is 64-bit, e.g. an error code of 0xc0000d0300000000
> will be converted to 0, which is not expected.
>
> Improves the implementation by using bool in KVM_BUG and KVM_BUG_ON.
> 'bool' is preferred to 'int' as __ret is essentially used as a boolean
> and coding-stytle.rst documents that use of bool is encouraged to improve
> readability and is often a better option than 'int' for storing boolean
> values.
>
> Fixes: 0b8f11737cff ("KVM: Add infrastructure and macro to mark VM as bugged")
> Signed-off-by: Wei Wang <wei.w.wang@...el.com>
> ---
Reviewed-by: Mingwei Zhang <mizhang@...gle.com>
Powered by blists - more mailing lists