[PATCH v2 03/11] lib: sbi: Fix domain_count check in sbi_domain_finalize()

Anup Patel Anup.Patel at wdc.com
Sat Dec 5 04:49:45 EST 2020



> -----Original Message-----
> From: Anup Patel <Anup.Patel at wdc.com>
> Sent: 04 December 2020 21:22
> To: Atish Patra <Atish.Patra at wdc.com>; Alistair Francis
> <Alistair.Francis at wdc.com>
> Cc: Anup Patel <anup at brainfault.org>; opensbi at lists.infradead.org; Anup
> Patel <Anup.Patel at wdc.com>; Alistair Francis <Alistair.Francis at wdc.com>
> Subject: [PATCH v2 03/11] lib: sbi: Fix domain_count check in
> sbi_domain_finalize()
> 
> The domain_count check in sbi_domain_finalize() for newly discovered
> domain is incorrect and should be reversed.
> 
> Signed-off-by: Anup Patel <anup.patel at wdc.com>
> Reviewed-by: Alistair Francis <alistair.francis at wdc.com>
> Reviewed-by: Atish Patra <atish.patra at wdc.com>
> ---
>  lib/sbi/sbi_domain.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/sbi/sbi_domain.c b/lib/sbi/sbi_domain.c index
> 4c98a1b..ac920b8 100644
> --- a/lib/sbi/sbi_domain.c
> +++ b/lib/sbi/sbi_domain.c
> @@ -371,7 +371,7 @@ int sbi_domain_finalize(struct sbi_scratch *scratch,
> u32 cold_hartid)
>  			 * Ensure that we have room for Domain Index to
>  			 * HART ID mapping
>  			 */
> -			if (domain_count <= SBI_DOMAIN_MAX_INDEX)
> +			if (SBI_DOMAIN_MAX_INDEX <= domain_count)
>  				return SBI_ENOSPC;
> 
>  			/* Sanitize discovered domain */
> --
> 2.25.1

Applied this patch to the riscv/opensbi repo.

Regards,
Anup




More information about the opensbi mailing list