diff mbox series

multi-process: Avoid logical AND of mutually exclusive tests

Message ID 1620402803-9237-1-git-send-email-jag.raman@oracle.com (mailing list archive)
State New, archived
Headers show
Series multi-process: Avoid logical AND of mutually exclusive tests | expand

Commit Message

Jag Raman May 7, 2021, 3:53 p.m. UTC
Fixes an if statement that performs a logical AND of mutually exclusive
tests

Reported-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Jagannathan Raman <jag.raman@oracle.com>
---
 hw/remote/mpqemu-link.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Thomas Huth May 8, 2021, 4:34 a.m. UTC | #1
On 07/05/2021 17.53, Jagannathan Raman wrote:
> Fixes an if statement that performs a logical AND of mutually exclusive
> tests
> 
> Reported-by: Thomas Huth <thuth@redhat.com>

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

Buglink: https://bugs.launchpad.net/qemu/+bug/1926995
Reviewed-by: Thomas Huth <thuth@redhat.com>

> Signed-off-by: Jagannathan Raman <jag.raman@oracle.com>
> ---
>   hw/remote/mpqemu-link.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/remote/mpqemu-link.c b/hw/remote/mpqemu-link.c
> index 9ce3152..e67a5de 100644
> --- a/hw/remote/mpqemu-link.c
> +++ b/hw/remote/mpqemu-link.c
> @@ -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;
>       }
Stefan Hajnoczi May 13, 2021, 4:02 p.m. UTC | #2
On Fri, May 07, 2021 at 11:53:23AM -0400, Jagannathan Raman wrote:
> Fixes an if statement that performs a logical AND of mutually exclusive
> tests
> 
> Reported-by: Thomas Huth <thuth@redhat.com>
> Signed-off-by: Jagannathan Raman <jag.raman@oracle.com>
> ---
>  hw/remote/mpqemu-link.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Laurent Vivier May 13, 2021, 4:16 p.m. UTC | #3
Le 08/05/2021 à 06:34, Thomas Huth a écrit :
> On 07/05/2021 17.53, Jagannathan Raman wrote:
>> Fixes an if statement that performs a logical AND of mutually exclusive
>> tests
>>
>> Reported-by: Thomas Huth <thuth@redhat.com>
> 
> I just spotted the bug ticket on Launchpad :-) So whoever picks this patch up, please add this instead:
> 
> Buglink: https://bugs.launchpad.net/qemu/+bug/1926995
> Reviewed-by: Thomas Huth <thuth@redhat.com>

Applied to my trivial-patches branch.

Thanks,
Laurent

>> Signed-off-by: Jagannathan Raman <jag.raman@oracle.com>
>> ---
>>   hw/remote/mpqemu-link.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/hw/remote/mpqemu-link.c b/hw/remote/mpqemu-link.c
>> index 9ce3152..e67a5de 100644
>> --- a/hw/remote/mpqemu-link.c
>> +++ b/hw/remote/mpqemu-link.c
>> @@ -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;
>>       }
> 
>
diff mbox series

Patch

diff --git a/hw/remote/mpqemu-link.c b/hw/remote/mpqemu-link.c
index 9ce3152..e67a5de 100644
--- a/hw/remote/mpqemu-link.c
+++ b/hw/remote/mpqemu-link.c
@@ -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;
     }