diff mbox series

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

Message ID 20201121094756.4154728-4-anup.patel@wdc.com
State Superseded
Headers show
Series OpenSBI domain configuration using device tree | expand

Commit Message

Anup Patel Nov. 21, 2020, 9:47 a.m. UTC
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@wdc.com>
---
 lib/sbi/sbi_domain.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Alistair Francis Dec. 1, 2020, 1:59 a.m. UTC | #1
On Sat, 2020-11-21 at 15:17 +0530, Anup Patel wrote:
> 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@wdc.com>

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>

Alistair

> ---
>  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 */
Atish Patra Dec. 3, 2020, 11:56 p.m. UTC | #2
On Sat, Nov 21, 2020 at 2:52 PM Anup Patel <anup.patel@wdc.com> wrote:
>
> 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@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
>
>
> --
> opensbi mailing list
> opensbi@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/opensbi


Reviewed-by: Atish Patra <atish.patra@wdc.com>
diff mbox series

Patch

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 */