diff mbox series

[3/6] ppc/xive2: Fix logical / bitwise comparison typo

Message ID 20250317052339.1108322-4-npiggin@gmail.com (mailing list archive)
State New
Headers show
Series ppc small fixes for 10.0 | expand

Commit Message

Nicholas Piggin March 17, 2025, 5:23 a.m. UTC
The comparison as written is always false (perhaps confusingly, because
the functions/macros are not really booleans but return 0 or the tested
bit value). Change to use logical-and.

Resolves: Coverity CID 1593721
Cc: Cédric Le Goater <clg@redhat.com>
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 hw/intc/xive2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Cédric Le Goater March 17, 2025, 7:06 a.m. UTC | #1
On 3/17/25 06:23, Nicholas Piggin wrote:
> The comparison as written is always false (perhaps confusingly, because
> the functions/macros are not really booleans but return 0 or the tested
> bit value). Change to use logical-and.
> 
> Resolves: Coverity CID 1593721
> Cc: Cédric Le Goater <clg@redhat.com>
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>


Reviewed-by: Cédric Le Goater <clg@redhat.com>

Thanks,

C.


> ---
>   hw/intc/xive2.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/intc/xive2.c b/hw/intc/xive2.c
> index 311b42e15d3..7d584dfafaf 100644
> --- a/hw/intc/xive2.c
> +++ b/hw/intc/xive2.c
> @@ -1344,7 +1344,7 @@ static void xive2_router_end_notify(Xive2Router *xrtr, uint8_t end_blk,
>           return;
>       }
>   
> -    if (xive2_end_is_crowd(&end) & !xive2_end_is_ignore(&end)) {
> +    if (xive2_end_is_crowd(&end) && !xive2_end_is_ignore(&end)) {
>           qemu_log_mask(LOG_GUEST_ERROR,
>                         "XIVE: invalid END, 'crowd' bit requires 'ignore' bit\n");
>           return;
diff mbox series

Patch

diff --git a/hw/intc/xive2.c b/hw/intc/xive2.c
index 311b42e15d3..7d584dfafaf 100644
--- a/hw/intc/xive2.c
+++ b/hw/intc/xive2.c
@@ -1344,7 +1344,7 @@  static void xive2_router_end_notify(Xive2Router *xrtr, uint8_t end_blk,
         return;
     }
 
-    if (xive2_end_is_crowd(&end) & !xive2_end_is_ignore(&end)) {
+    if (xive2_end_is_crowd(&end) && !xive2_end_is_ignore(&end)) {
         qemu_log_mask(LOG_GUEST_ERROR,
                       "XIVE: invalid END, 'crowd' bit requires 'ignore' bit\n");
         return;