forked from Mirrors/opensbi
		
	lib: sbi: Ensure domidx_to_domain_table is null-terminated
sbi_domain_for_each() requires domidx_to_domain_table[] to be null-terminated. Allocate one extra element which will always be null. Signed-off-by: Andrew Jones <ajones@ventanamicro.com> Reviewed-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
		@@ -17,8 +17,12 @@
 | 
			
		||||
#include <sbi/sbi_scratch.h>
 | 
			
		||||
#include <sbi/sbi_string.h>
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * We allocate an extra element because sbi_domain_for_each() expects
 | 
			
		||||
 * the array to be null-terminated.
 | 
			
		||||
 */
 | 
			
		||||
struct sbi_domain *domidx_to_domain_table[SBI_DOMAIN_MAX_INDEX + 1] = { 0 };
 | 
			
		||||
struct sbi_domain *hartid_to_domain_table[SBI_HARTMASK_MAX_BITS] = { 0 };
 | 
			
		||||
struct sbi_domain *domidx_to_domain_table[SBI_DOMAIN_MAX_INDEX] = { 0 };
 | 
			
		||||
static u32 domain_count = 0;
 | 
			
		||||
static bool domain_finalized = false;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user