Skip to contentSkip to conversation

multi-process: Avoid logical AND of mutually exclusive tests

PATCH Applied Jagannathan Raman 4 participants 4 messages May 7, 2021 – May 13, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 multi-process: Avoid logical AND of mutually exclusive tests

Fixes an if statement that performs a logical AND of mutually exclusive tests

---
 hw/remote/mpqemu-link.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/remote/mpqemu-link.c +1 -1
index 9ce3152..e67a5de 100644
@@ -218,7 +218,7 @@ uint64_t mpqemu_msg_send_and_await_reply(MPQemuMsg *msg, PCIProxyDev *pdev,
 
 bool mpqemu_msg_valid(MPQemuMsg *msg)
 {
-    if (msg->cmd >= MPQEMU_CMD_MAX && msg->cmd < 0) {
+    if (msg->cmd >= MPQEMU_CMD_MAX || msg->cmd < 0) {
         return false;
     }
 
Signature · 1 line
1.8.3.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Jagannathan Raman

Fixes an if statement that performs a logical AND of mutually exclusive tests

I just spotted the bug ticket on Launchpad :-) So whoever picks this patch up, please add this instead:

Quoted 17 lines
---
  hw/remote/mpqemu-link.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
hw/remote/mpqemu-link.c +1 -1
index 9ce3152..e67a5de 100644
@@ -218,7 +218,7 @@ uint64_t mpqemu_msg_send_and_await_reply(MPQemuMsg *msg, PCIProxyDev *pdev,
 
  bool mpqemu_msg_valid(MPQemuMsg *msg)
  {
-    if (msg->cmd >= MPQEMU_CMD_MAX && msg->cmd < 0) {
+    if (msg->cmd >= MPQEMU_CMD_MAX || msg->cmd < 0) {
          return false;
      }
#2 lore raw

Le 08/05/2021 à 06:34, Thomas Huth a écrit :

Quoted 10 lines · Jagannathan Raman
Quoted 4 lines

Fixes an if statement that performs a logical AND of mutually exclusive tests

I just spotted the bug ticket on Launchpad :-) So whoever picks this patch up, please add this instead:

Applied to my trivial-patches branch.

Thanks,
Laurent

Quoted 18 lines
Quoted 16 lines

---
  hw/remote/mpqemu-link.c | 2 +-

  1 file changed, 1 insertion(+), 1 deletion(-)
hw/remote/mpqemu-link.c +1 -1
index 9ce3152..e67a5de 100644
@@ -218,7 +218,7 @@ uint64_t mpqemu_msg_send_and_await_reply(MPQemuMsg *msg, PCIProxyDev *pdev,
     bool mpqemu_msg_valid(MPQemuMsg *msg)
   {
-    if (msg->cmd >= MPQEMU_CMD_MAX && msg->cmd < 0) {
+    if (msg->cmd >= MPQEMU_CMD_MAX || msg->cmd < 0) {
           return false;
       }