From 4fdf79cca5d76d3985a79a89a38709141130a801 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Fri, 9 Sep 2022 08:04:40 +0200 Subject: score: Prevent an out of bounds warning Update #4702. --- cpukit/score/src/percpudata.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'cpukit/score') 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); } } } -- cgit v1.2.3