diff mbox series

firmware: Remove the sanity checks in fw_save_info()

Message ID 20210707100021.4532-1-bmeng.cn@gmail.com
State Accepted
Headers show
Series firmware: Remove the sanity checks in fw_save_info() | expand

Commit Message

Bin Meng July 7, 2021, 10 a.m. UTC
The sanity checks on the magic and version was already done in
fw_boot_hart(), which happens before fw_save_info() is called.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
---

 firmware/fw_dynamic.S | 8 --------
 1 file changed, 8 deletions(-)

Comments

Xiang W July 8, 2021, 12:46 a.m. UTC | #1
在 2021-07-07星期三的 18:00 +0800,Bin Meng写道:
> The sanity checks on the magic and version was already done in
> fw_boot_hart(), which happens before fw_save_info() is called.
> 
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Xiang W <wxjstz@126.com>
> ---
> 
>  firmware/fw_dynamic.S | 8 --------
>  1 file changed, 8 deletions(-)
> 
> diff --git a/firmware/fw_dynamic.S b/firmware/fw_dynamic.S
> index 2b7ec3b..2b60196 100644
> --- a/firmware/fw_dynamic.S
> +++ b/firmware/fw_dynamic.S
> @@ -57,14 +57,6 @@ fw_save_info:
>         lla     a4, _dynamic_next_arg1
>         REG_S   a1, (a4)
>  
> -       /* Sanity checks */
> -       li      a4, FW_DYNAMIC_INFO_MAGIC_VALUE
> -       REG_L   a3, FW_DYNAMIC_INFO_MAGIC_OFFSET(a2)
> -       bne     a3, a4, _bad_dynamic_info
> -       li      a4, FW_DYNAMIC_INFO_VERSION_MAX
> -       REG_L   a3, FW_DYNAMIC_INFO_VERSION_OFFSET(a2)
> -       bgt     a3, a4, _bad_dynamic_info
> -
>         /* Save version == 0x1 fields */
>         lla     a4, _dynamic_next_addr
>         REG_L   a3, FW_DYNAMIC_INFO_NEXT_ADDR_OFFSET(a2)
> -- 
> 2.25.1
> 
>
Anup Patel July 11, 2021, 8:52 a.m. UTC | #2
On Thu, Jul 8, 2021 at 6:16 AM Xiang W <wxjstz@126.com> wrote:
>
> 在 2021-07-07星期三的 18:00 +0800,Bin Meng写道:
> > The sanity checks on the magic and version was already done in
> > fw_boot_hart(), which happens before fw_save_info() is called.
> >
> > Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> Reviewed-by: Xiang W <wxjstz@126.com>

Reviewed-by: Anup Patel <anup.patel@wdc.com>

Applied this patch to the riscv/opensbi repo.

Thanks,
Anup

> > ---
> >
> >  firmware/fw_dynamic.S | 8 --------
> >  1 file changed, 8 deletions(-)
> >
> > diff --git a/firmware/fw_dynamic.S b/firmware/fw_dynamic.S
> > index 2b7ec3b..2b60196 100644
> > --- a/firmware/fw_dynamic.S
> > +++ b/firmware/fw_dynamic.S
> > @@ -57,14 +57,6 @@ fw_save_info:
> >         lla     a4, _dynamic_next_arg1
> >         REG_S   a1, (a4)
> >
> > -       /* Sanity checks */
> > -       li      a4, FW_DYNAMIC_INFO_MAGIC_VALUE
> > -       REG_L   a3, FW_DYNAMIC_INFO_MAGIC_OFFSET(a2)
> > -       bne     a3, a4, _bad_dynamic_info
> > -       li      a4, FW_DYNAMIC_INFO_VERSION_MAX
> > -       REG_L   a3, FW_DYNAMIC_INFO_VERSION_OFFSET(a2)
> > -       bgt     a3, a4, _bad_dynamic_info
> > -
> >         /* Save version == 0x1 fields */
> >         lla     a4, _dynamic_next_addr
> >         REG_L   a3, FW_DYNAMIC_INFO_NEXT_ADDR_OFFSET(a2)
> > --
> > 2.25.1
> >
> >
>
>
>
> --
> opensbi mailing list
> opensbi@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/opensbi
diff mbox series

Patch

diff --git a/firmware/fw_dynamic.S b/firmware/fw_dynamic.S
index 2b7ec3b..2b60196 100644
--- a/firmware/fw_dynamic.S
+++ b/firmware/fw_dynamic.S
@@ -57,14 +57,6 @@  fw_save_info:
 	lla	a4, _dynamic_next_arg1
 	REG_S	a1, (a4)
 
-	/* Sanity checks */
-	li	a4, FW_DYNAMIC_INFO_MAGIC_VALUE
-	REG_L	a3, FW_DYNAMIC_INFO_MAGIC_OFFSET(a2)
-	bne	a3, a4, _bad_dynamic_info
-	li	a4, FW_DYNAMIC_INFO_VERSION_MAX
-	REG_L	a3, FW_DYNAMIC_INFO_VERSION_OFFSET(a2)
-	bgt	a3, a4, _bad_dynamic_info
-
 	/* Save version == 0x1 fields */
 	lla	a4, _dynamic_next_addr
 	REG_L	a3, FW_DYNAMIC_INFO_NEXT_ADDR_OFFSET(a2)