On 4/27/23 15:36, Patrick Delaunay wrote:
> Change the default base for offset parsing with simple_strtoull(),
> so offset in flashlayout is coded in base 10 by default, even if string
> start with '0'. The Octal encoding is not supported. The base 16
> is still supported when the '0x' header is detected.
> 
> This patch solves an unexpected parsing result when the address,
> provided by decimal value is starting by 0, for example 0x4400 = 00017408
> is a invalid with current code.
> 
> ...
> P     0x04    fsbl1   Binary  mmc0    00017408                tf-a.stm32
> ....
> 
> Signed-off-by: Patrick Delaunay <patrick.delau...@foss.st.com>
> ---
> 
>  arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c 
> b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c
> index c85217f6d61e..90cf6c39b4a2 100644
> --- a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c
> +++ b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c
> @@ -514,7 +514,7 @@ static int parse_offset(struct stm32prog_data *data,
>                       stm32prog_err("Layout line %d: invalid part '%s'",
>                                     i, p);
>       } else {
> -             part->addr = simple_strtoull(p, &tail, 0);
> +             part->addr = simple_strtoull(p, &tail, 10);
>               if (tail == p || *tail != '\0') {
>                       stm32prog_err("Layout line %d: invalid offset '%s'",
>                                     i, p);
Reviewed-by: Patrice Chotard <patrice.chot...@foss.st.com>

Thanks
Patrice

Reply via email to