spapr: nested: use bitwise NOT operator for flags check
PATCH 1/1 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. Reported by Coverity as CID 1540008, 1540009.
Reported-by Peter Maydell <[email protected]>
Signed-off by: Harsh Prateek Bora <[email protected]>
--- hw/ppc/spapr_nested.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/ppc/spapr_nested.c +1 -1
@@ -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 */ }
Signature · 1 line
2.39.3
Quoted 9 lines · Harsh Prateek Bora
Check for flag bit in
H_GUEST_GETSET_STATE_FLAG_GUEST_WIDEneed to use bitwise NOT operator to ensure no other flag bits are set. Reported by Coverity as CID 1540008, 1540009.Reported-by Peter Maydell <[email protected]>Signed-off by: Harsh Prateek Bora <[email protected]>
--- hw/ppc/spapr_nested.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by Philippe Mathieu-Daudé <[email protected]>