summaryrefslogtreecommitdiffstats
path: root/cpukit/rtems
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2018-08-02 14:49:01 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2018-08-02 15:33:00 +0200
commit27bbc0598b4f1a85321fbc47d0f8446e37ea0d12 (patch)
tree80e1367a979a1046d0285bbed60e814aa8696951 /cpukit/rtems
parentbsp/riscv: Add missing BSP variant (diff)
downloadrtems-27bbc0598b4f1a85321fbc47d0f8446e37ea0d12.tar.bz2
score: Remove CPU_PARTITION_ALIGNMENT
Use the CPU_SIZEOF_POINTER alignment instead. The internal alignment requirement is defined by the use of Chain_Node (consisting of two pointers) to manage the free chain of partitions. It seems that previously the condition CPU_PARTITION_ALIGNMENT >= sizeof(Chain_Node) was true on all CPU ports. Now, we need an additional check. Update #3482.
Diffstat (limited to 'cpukit/rtems')
-rw-r--r--cpukit/rtems/src/partcreate.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/cpukit/rtems/src/partcreate.c b/cpukit/rtems/src/partcreate.c
index c058adff1f..2facb42e3a 100644
--- a/cpukit/rtems/src/partcreate.c
+++ b/cpukit/rtems/src/partcreate.c
@@ -64,8 +64,19 @@ rtems_status_code rtems_partition_create(
if ( !id )
return RTEMS_INVALID_ADDRESS;
- if ( length == 0 || buffer_size == 0 || length < buffer_size ||
- !_Partition_Is_buffer_size_aligned( buffer_size ) )
+ if ( length == 0 )
+ return RTEMS_INVALID_SIZE;
+
+ if ( buffer_size == 0 )
+ return RTEMS_INVALID_SIZE;
+
+ if ( length < buffer_size )
+ return RTEMS_INVALID_SIZE;
+
+ if ( !_Partition_Is_buffer_size_aligned( buffer_size ) )
+ return RTEMS_INVALID_SIZE;
+
+ if ( buffer_size < sizeof( Chain_Node ) )
return RTEMS_INVALID_SIZE;
if ( !_Addresses_Is_aligned( starting_address ) )