Print this page
5083 avoid undefined order of operations in assignments
*** 22,33 ****
/*
* Copyright 2002 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
- #pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* smq.c: to provide a message queue system for scadm functions (used in the
* firmware download context where BP messages, received from the service
* processor, are stored in the message queue)
*
--- 22,31 ----
*** 89,100 ****
return (SMQ_ERROR);
/* Copy messaged into queue */
*msg = *smq->smq_head;
! /* Increment Head */
! smq->smq_head = smq->smq_head++;
if ((unsigned long)smq->smq_head > ((unsigned long)smq->smq_msgBuffer +
(unsigned long)(smq->smq_depth * sizeof (smq_msg_t)))) {
smq->smq_head = smq->smq_msgBuffer;
}
smq->smq_count--;
--- 87,97 ----
return (SMQ_ERROR);
/* Copy messaged into queue */
*msg = *smq->smq_head;
! smq->smq_head++;
if ((unsigned long)smq->smq_head > ((unsigned long)smq->smq_msgBuffer +
(unsigned long)(smq->smq_depth * sizeof (smq_msg_t)))) {
smq->smq_head = smq->smq_msgBuffer;
}
smq->smq_count--;
*** 113,124 ****
return (SMQ_FULL);
/* Copy messaged into queue */
*smq->smq_tail = *msg;
! /* Increment Tail */
! smq->smq_tail = smq->smq_tail++;
if ((unsigned long)smq->smq_tail > ((unsigned long)smq->smq_msgBuffer +
(unsigned long)(smq->smq_depth * sizeof (smq_msg_t)))) {
smq->smq_tail = smq->smq_msgBuffer;
}
--- 110,120 ----
return (SMQ_FULL);
/* Copy messaged into queue */
*smq->smq_tail = *msg;
! smq->smq_tail++;
if ((unsigned long)smq->smq_tail > ((unsigned long)smq->smq_msgBuffer +
(unsigned long)(smq->smq_depth * sizeof (smq_msg_t)))) {
smq->smq_tail = smq->smq_msgBuffer;
}
*** 173,184 ****
return (SMQ_ERROR);
/* Copy messaged into queue */
*msg = *smq->smq_head;
! /* Increment Head */
! smq->smq_head = smq->smq_head++;
if ((unsigned long)smq->smq_head > ((unsigned long)smq->smq_msgBuffer +
(unsigned long)(smq->smq_depth * sizeof (smq_msg_t)))) {
smq->smq_head = smq->smq_msgBuffer;
}
smq->smq_count--;
--- 169,179 ----
return (SMQ_ERROR);
/* Copy messaged into queue */
*msg = *smq->smq_head;
! smq->smq_head++;
if ((unsigned long)smq->smq_head > ((unsigned long)smq->smq_msgBuffer +
(unsigned long)(smq->smq_depth * sizeof (smq_msg_t)))) {
smq->smq_head = smq->smq_msgBuffer;
}
smq->smq_count--;