The current lib/msg.c code produces this warning at compile time:

warning: comparison is always false due to limited range of data type

In the saMsgMessageSend, we must check that the message priority is
valid. Since message->priority is unsigned, checking if it less than
zero (SA_MSG_MESSAGE_HIGHEST_PRIORITY) will always return false. We
only need to check that it is not greater than
SA_MSG_MESSAGE_LOWEST_PRIORITY.

Index: lib/msg.c
===================================================================
--- lib/msg.c   (revision 1837)
+++ lib/msg.c   (working copy)
@@ -1378,8 +1378,7 @@
                goto error_exit;
        }
 
-       if ((message->priority < SA_MSG_MESSAGE_HIGHEST_PRIORITY) ||
-           (message->priority > SA_MSG_MESSAGE_LOWEST_PRIORITY))
+       if (message->priority > SA_MSG_MESSAGE_LOWEST_PRIORITY)
        {
                error = SA_AIS_ERR_INVALID_PARAM;
                goto error_exit;
_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais

Reply via email to