forked from Mirrors/opensbi
		
	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 <wxjstz@126.com>
This commit is contained in:
		@@ -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,
 | 
			
		||||
 
 | 
			
		||||
@@ -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,
 | 
			
		||||
 
 | 
			
		||||
@@ -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,
 | 
			
		||||
 
 | 
			
		||||
@@ -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,
 | 
			
		||||
 
 | 
			
		||||
@@ -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,
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user