diff mbox series

[U-Boot] spl: atf: Fix uninitialized pointer to bl31_image_info

Message ID 20190627070224.18758-1-frieder.schrempf@kontron.de
State Accepted
Commit a239b82dad03ad942aaf5fbbda672e882968488c
Delegated to: Kever Yang
Headers show
Series [U-Boot] spl: atf: Fix uninitialized pointer to bl31_image_info | expand

Commit Message

Frieder Schrempf June 27, 2019, 7:03 a.m. UTC
From: Frieder Schrempf <frieder.schrempf@kontron.de>

The pointer to struct atf_image_info in
bl31_params_mem.bl31_params.bl31_image_info is not initialized before
being dereferenced. This can cause U-Boot to crash right before jumping
to the BL31 ATF binary.

Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Fixes: bcc1726a7bdd ("spl: add support to booting with ATF")
---
 common/spl/spl_atf.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Kever Yang July 2, 2019, 2:16 a.m. UTC | #1
Hi Frieder,


On 06/27/2019 03:03 PM, Schrempf Frieder wrote:
> From: Frieder Schrempf <frieder.schrempf@kontron.de>
>
> The pointer to struct atf_image_info in
> bl31_params_mem.bl31_params.bl31_image_info is not initialized before
> being dereferenced. This can cause U-Boot to crash right before jumping
> to the BL31 ATF binary.
>
> Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
> Fixes: bcc1726a7bdd ("spl: add support to booting with ATF")

Reviewed-by: Kever Yang <kever.yang@rock-chips.com>

Thanks,
- Kever

> ---
>  common/spl/spl_atf.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/common/spl/spl_atf.c b/common/spl/spl_atf.c
> index cddab6a735..4715f9d371 100644
> --- a/common/spl/spl_atf.c
> +++ b/common/spl/spl_atf.c
> @@ -45,6 +45,7 @@ static struct bl31_params *bl2_plat_get_bl31_params(uintptr_t bl33_entry)
>  	SET_PARAM_HEAD(bl2_to_bl31_params, ATF_PARAM_BL31, ATF_VERSION_1, 0);
>  
>  	/* Fill BL31 related information */
> +	bl2_to_bl31_params->bl31_image_info = &bl31_params_mem.bl31_image_info;
>  	SET_PARAM_HEAD(bl2_to_bl31_params->bl31_image_info,
>  		       ATF_PARAM_IMAGE_BINARY, ATF_VERSION_1, 0);
>
Kever Yang July 2, 2019, 2:33 a.m. UTC | #2
On 07/02/2019 10:16 AM, Kever Yang wrote:
> Hi Frieder,
>
>
> On 06/27/2019 03:03 PM, Schrempf Frieder wrote:
>> From: Frieder Schrempf <frieder.schrempf@kontron.de>
>>
>> The pointer to struct atf_image_info in
>> bl31_params_mem.bl31_params.bl31_image_info is not initialized before
>> being dereferenced. This can cause U-Boot to crash right before jumping
>> to the BL31 ATF binary.
>>
>> Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
>> Fixes: bcc1726a7bdd ("spl: add support to booting with ATF")
> Reviewed-by: Kever Yang <kever.yang@rock-chips.com>

Applied to u-boot-rockchip/master

Thanks,
- Kever
>
> Thanks,
> - Kever
>
>> ---
>>  common/spl/spl_atf.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/common/spl/spl_atf.c b/common/spl/spl_atf.c
>> index cddab6a735..4715f9d371 100644
>> --- a/common/spl/spl_atf.c
>> +++ b/common/spl/spl_atf.c
>> @@ -45,6 +45,7 @@ static struct bl31_params *bl2_plat_get_bl31_params(uintptr_t bl33_entry)
>>  	SET_PARAM_HEAD(bl2_to_bl31_params, ATF_PARAM_BL31, ATF_VERSION_1, 0);
>>  
>>  	/* Fill BL31 related information */
>> +	bl2_to_bl31_params->bl31_image_info = &bl31_params_mem.bl31_image_info;
>>  	SET_PARAM_HEAD(bl2_to_bl31_params->bl31_image_info,
>>  		       ATF_PARAM_IMAGE_BINARY, ATF_VERSION_1, 0);
>>  
> _______________________________________________
> U-Boot mailing list
> U-Boot@lists.denx.de
> https://lists.denx.de/listinfo/u-boot
diff mbox series

Patch

diff --git a/common/spl/spl_atf.c b/common/spl/spl_atf.c
index cddab6a735..4715f9d371 100644
--- a/common/spl/spl_atf.c
+++ b/common/spl/spl_atf.c
@@ -45,6 +45,7 @@  static struct bl31_params *bl2_plat_get_bl31_params(uintptr_t bl33_entry)
 	SET_PARAM_HEAD(bl2_to_bl31_params, ATF_PARAM_BL31, ATF_VERSION_1, 0);
 
 	/* Fill BL31 related information */
+	bl2_to_bl31_params->bl31_image_info = &bl31_params_mem.bl31_image_info;
 	SET_PARAM_HEAD(bl2_to_bl31_params->bl31_image_info,
 		       ATF_PARAM_IMAGE_BINARY, ATF_VERSION_1, 0);