From 9eb8f0f90d5c873576d18d405bbd932ad9688741 Mon Sep 17 00:00:00 2001 From: Xiang Wang Date: Wed, 6 Mar 2019 15:29:34 +0800 Subject: platform: Make the `platform` read-only platform should be a read-only variable, if it is placed in the data segment, it may be exploited. Signed-off-by: Xiang Wang --- platform/kendryte/k210/platform.c | 2 +- platform/qemu/sifive_u/platform.c | 2 +- platform/qemu/virt/platform.c | 2 +- platform/sifive/fu540/platform.c | 2 +- platform/template/platform.c | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) (limited to 'platform') diff --git a/platform/kendryte/k210/platform.c b/platform/kendryte/k210/platform.c index 104edccb..cba83dae 100644 --- a/platform/kendryte/k210/platform.c +++ b/platform/kendryte/k210/platform.c @@ -98,7 +98,7 @@ static int k210_system_shutdown(u32 type) return 0; } -struct sbi_platform platform = { +const struct sbi_platform platform = { .name = "Kendryte K210", .features = SBI_PLATFORM_HAS_TIMER_VALUE, diff --git a/platform/qemu/sifive_u/platform.c b/platform/qemu/sifive_u/platform.c index e8542f2e..cc8993d9 100644 --- a/platform/qemu/sifive_u/platform.c +++ b/platform/qemu/sifive_u/platform.c @@ -125,7 +125,7 @@ static int sifive_u_system_down(u32 type) return 0; } -struct sbi_platform platform = { +const struct sbi_platform platform = { .name = "QEMU SiFive Unleashed", .features = SBI_PLATFORM_DEFAULT_FEATURES, .hart_count = SIFIVE_U_HART_COUNT, diff --git a/platform/qemu/virt/platform.c b/platform/qemu/virt/platform.c index ab40b939..fd4d8299 100644 --- a/platform/qemu/virt/platform.c +++ b/platform/qemu/virt/platform.c @@ -134,7 +134,7 @@ static int virt_system_down(u32 type) return 0; } -struct sbi_platform platform = { +const struct sbi_platform platform = { .name = "QEMU Virt Machine", .features = SBI_PLATFORM_DEFAULT_FEATURES, .hart_count = VIRT_HART_COUNT, diff --git a/platform/sifive/fu540/platform.c b/platform/sifive/fu540/platform.c index a244d10f..c14275ab 100644 --- a/platform/sifive/fu540/platform.c +++ b/platform/sifive/fu540/platform.c @@ -187,7 +187,7 @@ static int fu540_system_down(u32 type) return 0; } -struct sbi_platform platform = { +const struct sbi_platform platform = { .name = "SiFive Freedom U540", .features = SBI_PLATFORM_DEFAULT_FEATURES, .hart_count = FU540_HART_COUNT, diff --git a/platform/template/platform.c b/platform/template/platform.c index c14398f8..866d2734 100644 --- a/platform/template/platform.c +++ b/platform/template/platform.c @@ -207,7 +207,7 @@ static int platform_system_shutdown(u32 type) /* * Platform descriptor. */ -struct sbi_platform platform = { +const struct sbi_platform platform = { .name = "platform-name", .features = SBI_PLATFORM_DEFAULT_FEATURES, -- cgit v1.3.1