Changeset e18303d9 in rtems


Ignore:
Timestamp:
Jul 14, 2004, 9:05:38 PM (17 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Children:
7feb6f9
Parents:
72dfb96
Message:

2004-07-14 Joel Sherrill <joel@…>

PR 650/rtems

  • src/coremsg.c: Check for mathemathical overflow when calculating amount of memory to allocate for message buffers.
Location:
cpukit/score
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • cpukit/score/ChangeLog

    r72dfb96 re18303d9  
     12004-07-14      Joel Sherrill <joel@OARcorp.com>
     2
     3        PR 650/rtems
     4        * src/coremsg.c: Check for mathemathical overflow when calculating
     5        amount of memory to allocate for message buffers.
     6
    172004-05-06      Joel Sherrill <joel@OARcorp.com>
    28
  • cpukit/score/src/coremsg.c

    r72dfb96 re18303d9  
    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 
     
    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 );
     
    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,
Note: See TracChangeset for help on using the changeset viewer.