On 1/8/25 19:49, Patrick DELAUNAY wrote:
> Hi,
>
> On 11/29/24 13:27, Patrice Chotard wrote:
>> In arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c, in init_device(),
>> in case of RAW_IMAGE, part->size = block_dev->lba * block_dev->blksz.
>>
>> _ part->size is declared as u64.
>> _ block_dev->lba is declared as lbaint_t which is uint64_t
>> if CONFIG_SYS_64BIT_LBA is enable, otherwise ulong.
>> _ block_dev->blksz is declared as unsigned long.
>>
>> For example, in case block_dev->lba = 0x1dacc00, block_dev->blksz = 0x200
>> then part->size 0x5980000 which is incorrect as both are declared as ulong.
>>
>> To fix this overflow issue, enable CONFIG_SYS_64BIT_LBA, block_dev->lba is
>> then declared as uint64_t and part->size get the correct value 0x3b5980000.
>>
>> Signed-off-by: Patrice Chotard <patrice.chot...@foss.st.com>
>> ---
>>
>> configs/stm32mp15_basic_defconfig | 1 +
>> configs/stm32mp15_defconfig | 1 +
>> configs/stm32mp15_trusted_defconfig | 1 +
>> 3 files changed, 3 insertions(+)
>>
>> diff --git a/configs/stm32mp15_basic_defconfig
>> b/configs/stm32mp15_basic_defconfig
>> index 1c0d0d0a073..a8861faab0e 100644
>> --- a/configs/stm32mp15_basic_defconfig
>> +++ b/configs/stm32mp15_basic_defconfig
>> @@ -95,6 +95,7 @@ CONFIG_TFTP_TSIZE=y
>> CONFIG_USE_SERVERIP=y
>> CONFIG_SERVERIP="192.168.1.1"
>> CONFIG_STM32_ADC=y
>> +CONFIG_SYS_64BIT_LBA=y
>> CONFIG_BUTTON=y
>> CONFIG_BUTTON_GPIO=y
>> CONFIG_SET_DFU_ALT_INFO=y
>> diff --git a/configs/stm32mp15_defconfig b/configs/stm32mp15_defconfig
>> index f58a514308b..d31349e3f2b 100644
>> --- a/configs/stm32mp15_defconfig
>> +++ b/configs/stm32mp15_defconfig
>> @@ -69,6 +69,7 @@ CONFIG_TFTP_TSIZE=y
>> CONFIG_USE_SERVERIP=y
>> CONFIG_SERVERIP="192.168.1.1"
>> CONFIG_STM32_ADC=y
>> +CONFIG_SYS_64BIT_LBA=y
>> CONFIG_BUTTON=y
>> CONFIG_BUTTON_GPIO=y
>> CONFIG_CLK_SCMI=y
>> diff --git a/configs/stm32mp15_trusted_defconfig
>> b/configs/stm32mp15_trusted_defconfig
>> index 2e99b8e6a85..1f807f37c69 100644
>> --- a/configs/stm32mp15_trusted_defconfig
>> +++ b/configs/stm32mp15_trusted_defconfig
>> @@ -70,6 +70,7 @@ CONFIG_TFTP_TSIZE=y
>> CONFIG_USE_SERVERIP=y
>> CONFIG_SERVERIP="192.168.1.1"
>> CONFIG_STM32_ADC=y
>> +CONFIG_SYS_64BIT_LBA=y
>> CONFIG_BUTTON=y
>> CONFIG_BUTTON_GPIO=y
>> CONFIG_CLK_SCMI=y
>
>
> Reviewed-by: Patrick Delaunay <patrick.delau...@foss.st.com>
>
> Thanks
> Patrick
>
Applied to u-boot-stm32/master
Thanks
Patrice