* [PATCH] spapr: nested: use bitwise NOT operator for flags check
@ 2024-03-29 4:34 Harsh Prateek Bora
2024-03-29 12:38 ` Philippe Mathieu-Daudé
0 siblings, 1 reply; 2+ messages in thread
From: Harsh Prateek Bora @ 2024-03-29 4:34 UTC (permalink / raw)
To: npiggin, qemu-ppc; +Cc: mikey, danielhb413, qemu-devel, peter.maydell
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 <peter.maydell@linaro.org>
Signed-off by: Harsh Prateek Bora <harshpb@linux.ibm.com>
---
hw/ppc/spapr_nested.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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 */
}
--
2.39.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] spapr: nested: use bitwise NOT operator for flags check
2024-03-29 4:34 [PATCH] spapr: nested: use bitwise NOT operator for flags check Harsh Prateek Bora
@ 2024-03-29 12:38 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 2+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-03-29 12:38 UTC (permalink / raw)
To: Harsh Prateek Bora, npiggin, qemu-ppc
Cc: mikey, danielhb413, qemu-devel, peter.maydell
On 29/3/24 05:34, Harsh Prateek Bora wrote:
> 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 <peter.maydell@linaro.org>
> Signed-off by: Harsh Prateek Bora <harshpb@linux.ibm.com>
> ---
> hw/ppc/spapr_nested.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-03-29 12:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-29 4:34 [PATCH] spapr: nested: use bitwise NOT operator for flags check Harsh Prateek Bora
2024-03-29 12:38 ` Philippe Mathieu-Daudé
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).