hw/remote/mpqemu-link.c:221: bad error checking ?

Bug #1926995 reported by dcb
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
QEMU
Fix Released
High
Unassigned

Bug Description

hw/remote/mpqemu-link.c:221:36: warning: logical ‘and’ of mutually exclusive tests is always false [-Wlogical-op]

Source code is

   if (msg->cmd >= MPQEMU_CMD_MAX && msg->cmd < 0) {
        return false;
    }

Maybe better code:

   if (msg->cmd >= MPQEMU_CMD_MAX || msg->cmd < 0) {
        return false;
    }

It might be useful to switch on gcc compiler flag -Wlogical-op
to see these warnings.

Revision history for this message
Thomas Huth (th-huth) wrote :

Thanks, I've reported it on the mailing list, and a patch has now been posted here:
https://lists.gnu.org/archive/html/qemu-devel/2021-05/msg02106.html

Changed in qemu:
status: New → In Progress
importance: Undecided → High
Revision history for this message
Thomas Huth (th-huth) wrote :
Changed in qemu:
status: In Progress → Fix Committed
Thomas Huth (th-huth)
Changed in qemu:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.