Ticket #650: pr650.diff

File pr650.diff, 1.6 KB (added by Joel Sherrill, on 12/03/06 at 13:31:13)

pr650.diff

  • src/coremsg.c

    RCS file: /usr1/CVS/rtems/cpukit/score/src/coremsg.c,v
    retrieving revision 1.14.2.1
    diff -u -r1.14.2.1 coremsg.c
     
    6464  _CORE_message_queue_Set_notify( the_message_queue, NULL, NULL );
    6565 
    6666  /*
    67    * round size up to multiple of a ptr for chain init
     67   *  Round size up to multiple of a pointer for chain init and
     68   *  check for overflow on adding overhead to each message.
    6869   */
    6970 
    7071  allocated_message_size = maximum_message_size;
     
    7374      allocated_message_size &= ~(sizeof(unsigned32) - 1);
    7475  }
    7576   
     77  if (allocated_message_size < maximum_message_size)
     78    return FALSE;
     79
     80  /*
     81   *  Calculate how much total memory is required for message buffering and
     82   *  check for overflow on the multiplication.
     83   */
    7684  message_buffering_required = maximum_pending_messages *
    7785       (allocated_message_size + sizeof(CORE_message_queue_Buffer_control));
    7886 
     87  if (message_buffering_required < allocated_message_size)
     88    return FALSE;
     89
     90  /*
     91   *  Attempt to allocate the message memory
     92   */
    7993  the_message_queue->message_buffers = (CORE_message_queue_Buffer *)
    8094     _Workspace_Allocate( message_buffering_required );
    8195 
    8296  if (the_message_queue->message_buffers == 0)
    8397    return FALSE;
    8498 
     99  /*
     100   *  Initialize the pool of inactive messages, pending messages,
     101   *  and set of waiting threads.
     102   */
    85103  _Chain_Initialize (
    86104    &the_message_queue->Inactive_messages,
    87105    the_message_queue->message_buffers,