aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorAbhishek Singh Tomar <abhishek@linux.ibm.com>2022-01-24 19:26:12 +0530
committerCédric Le Goater <clg@kaod.org>2022-02-04 08:35:25 +0100
commita9bc782c843250a17255236acc210fbbe16ddf78 (patch)
treea1e47431d10c638dea932bc3574d38f4365e482e /core
parent095cef27f0f4aad58266516846e65363418cf7f1 (diff)
downloadskiboot-a9bc782c843250a17255236acc210fbbe16ddf78.zip
skiboot-a9bc782c843250a17255236acc210fbbe16ddf78.tar.gz
skiboot-a9bc782c843250a17255236acc210fbbe16ddf78.tar.bz2
Fix array-bound compilation warnings
Resolves : the warray bounds warning during compilation /build/libc/include/string.h:34:16: warning: '__builtin_memset' offset [0, 2097151] is out of the bounds [0, 0] [-Warray-bounds] 34 | #define memset __builtin_memset hw/fsp/fsp.c:1855:9: note: in expansion of macro 'memset' 1855 | memset(fsp_tce_table, 0, PSI_TCE_TABLE_SIZE); use volatile pointer to avoid optimization introduced with gcc-11 on constant address assignment to pointer. Signed-off-by: Abhishek Singh Tomar <abhishek@linux.ibm.com> Signed-off-by: Cédric Le Goater <clg@kaod.org>
Diffstat (limited to 'core')
-rw-r--r--core/console.c2
-rw-r--r--core/fast-reboot.c6
-rw-r--r--core/init.c6
-rw-r--r--core/opal-dump.c7
4 files changed, 14 insertions, 7 deletions
diff --git a/core/console.c b/core/console.c
index 2a15090..374ee03 100644
--- a/core/console.c
+++ b/core/console.c
@@ -15,7 +15,7 @@
#include <processor.h>
#include <cpu.h>
-static char *con_buf = (char *)INMEM_CON_START;
+static char *skiboot_constant_addr con_buf = (char *)INMEM_CON_START;
static size_t con_in;
static size_t con_out;
static bool con_wrapped;
diff --git a/core/fast-reboot.c b/core/fast-reboot.c
index fedfa88..6f6ef3a 100644
--- a/core/fast-reboot.c
+++ b/core/fast-reboot.c
@@ -307,6 +307,8 @@ void __noreturn fast_reboot_entry(void);
void __noreturn fast_reboot_entry(void)
{
struct cpu_thread *cpu = this_cpu();
+ void *skiboot_constant_addr kerneal_load_base_addr = KERNEL_LOAD_BASE;
+ void *skiboot_constant_addr initramfs_load_base_addr = INITRAMFS_LOAD_BASE;
if (proc_gen == proc_gen_p8) {
/* We reset our ICP first ! Otherwise we might get stray
@@ -425,8 +427,8 @@ void __noreturn fast_reboot_entry(void)
* Mambo may have embedded payload here, so don't clear
* it at all.
*/
- memset(KERNEL_LOAD_BASE, 0, KERNEL_LOAD_SIZE);
- memset(INITRAMFS_LOAD_BASE, 0, INITRAMFS_LOAD_SIZE);
+ memset(kerneal_load_base_addr, 0, KERNEL_LOAD_SIZE);
+ memset(initramfs_load_base_addr, 0, INITRAMFS_LOAD_SIZE);
}
/* Start preloading kernel and ramdisk */
diff --git a/core/init.c b/core/init.c
index b4d3351..a1fd5f2 100644
--- a/core/init.c
+++ b/core/init.c
@@ -869,7 +869,11 @@ void copy_exception_vectors(void)
* this is the boot flag used by CPUs still potentially entering
* skiboot.
*/
- memcpy((void *)0x100, (void *)(SKIBOOT_BASE + 0x100),
+ void *skiboot_constant_addr exception_vectors_start_addr = (void *)(SKIBOOT_BASE + 0x100);
+ void *skiboot_constant_addr dst = (void *)0x100;
+
+
+ memcpy(dst, exception_vectors_start_addr,
EXCEPTION_VECTORS_END - 0x100);
sync_icache();
}
diff --git a/core/opal-dump.c b/core/opal-dump.c
index 4f54a3e..577a906 100644
--- a/core/opal-dump.c
+++ b/core/opal-dump.c
@@ -301,6 +301,7 @@ static int64_t opal_mpipl_update(enum opal_mpipl_ops ops,
u64 src, u64 dest, u64 size)
{
int rc;
+ void *skiboot_constant_addr mdrt_table_base_addr = (void *) MDRT_TABLE_BASE;
switch (ops) {
case OPAL_MPIPL_ADD_RANGE:
@@ -330,7 +331,7 @@ static int64_t opal_mpipl_update(enum opal_mpipl_ops ops,
free(opal_mpipl_cpu_data);
opal_mpipl_cpu_data = NULL;
/* Clear MDRT table */
- memset((void *)MDRT_TABLE_BASE, 0, MDRT_TABLE_SIZE);
+ memset(mdrt_table_base_addr, 0, MDRT_TABLE_SIZE);
/* Set MDRT count to max allocated count */
ntuple_mdrt->act_cnt = cpu_to_be16(MDRT_TABLE_SIZE / sizeof(struct mdrt_table));
rc = OPAL_SUCCESS;
@@ -529,8 +530,8 @@ bool is_mpipl_enabled(void)
void opal_mpipl_init(void)
{
- void *mdst_base = (void *)MDST_TABLE_BASE;
- void *mddt_base = (void *)MDDT_TABLE_BASE;
+ void *skiboot_constant_addr mdst_base = (void *)MDST_TABLE_BASE;
+ void *skiboot_constant_addr mddt_base = (void *)MDDT_TABLE_BASE;
struct dt_node *dump_node;
dump_node = dt_find_by_path(opal_node, "dump");