[rtems commit] score: Prevent an out of bounds warning
Sebastian Huber
sebh at rtems.org
Mon Sep 12 07:27:51 UTC 2022
Module: rtems
Branch: master
Commit: 4fdf79cca5d76d3985a79a89a38709141130a801
Changeset: http://git.rtems.org/rtems/commit/?id=4fdf79cca5d76d3985a79a89a38709141130a801
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Fri Sep 9 08:04:40 2022 +0200
score: Prevent an out of bounds warning
Update #4702.
---
cpukit/score/src/percpudata.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/cpukit/score/src/percpudata.c b/cpukit/score/src/percpudata.c
index c81c1b6a16..6b31ef3602 100644
--- a/cpukit/score/src/percpudata.c
+++ b/cpukit/score/src/percpudata.c
@@ -66,14 +66,19 @@ static void _Per_CPU_Data_initialize( void )
size = RTEMS_LINKER_SET_SIZE( _Per_CPU_Data );
if ( size > 0 ) {
+ char *data_begin;
const Memory_Information *mem;
Per_CPU_Control *cpu;
uint32_t cpu_index;
uint32_t cpu_max;
+ /* Prevent an out of bounds warning in the memcpy() below */
+ data_begin = RTEMS_LINKER_SET_BEGIN( _Per_CPU_Data );
+ RTEMS_OBFUSCATE_VARIABLE( data_begin );
+
mem = _Memory_Get();
cpu = _Per_CPU_Get_by_index( 0 );
- cpu->data = RTEMS_LINKER_SET_BEGIN( _Per_CPU_Data );
+ cpu->data = data_begin;
cpu_max = rtems_configuration_get_maximum_processors();
@@ -85,7 +90,7 @@ static void _Per_CPU_Data_initialize( void )
_Internal_error( INTERNAL_ERROR_NO_MEMORY_FOR_PER_CPU_DATA );
}
- memcpy( cpu->data, RTEMS_LINKER_SET_BEGIN( _Per_CPU_Data ), size);
+ memcpy( cpu->data, data_begin, size);
}
}
}
More information about the vc
mailing list