From: Harsh Prateek Bora Date: Fri, 29 Mar 2024 04:34:36 +0000 (+0530) Subject: spapr: nested: use bitwise NOT operator for flags check X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=58cb91b34d9b1e87353c4a21ff39062dd8b25dd5;p=qemu.git spapr: nested: use bitwise NOT operator for flags check Check for flag bit in H_GUEST_GETSET_STATE_FLAG_GUEST_WIDE need to use bitwise NOT operator to ensure no other flag bits are set. Resolves: Coverity CID 1540008 Resolves: Coverity CID 1540009 Reported-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Signed-off by: Harsh Prateek Bora Signed-off-by: Nicholas Piggin --- diff --git a/hw/ppc/spapr_nested.c b/hw/ppc/spapr_nested.c index 936659b4c0..c02785756c 100644 --- a/hw/ppc/spapr_nested.c +++ b/hw/ppc/spapr_nested.c @@ -1511,7 +1511,7 @@ static target_ulong h_guest_getset_state(PowerPCCPU *cpu, if (flags & H_GUEST_GETSET_STATE_FLAG_GUEST_WIDE) { gsr.flags |= GUEST_STATE_REQUEST_GUEST_WIDE; } - if (flags & !H_GUEST_GETSET_STATE_FLAG_GUEST_WIDE) { + if (flags & ~H_GUEST_GETSET_STATE_FLAG_GUEST_WIDE) { return H_PARAMETER; /* flag not supported yet */ }