[PATCH] cmd: eeprom: don't truncate target address at 32-bit

Ramon Fried rfried.dev at gmail.com
Sun Oct 23 13:14:48 CEST 2022


On Sun, Oct 23, 2022 at 12:28 PM Baruch Siach <baruch at tkos.co.il> wrote:
>
> On 64-bit platforms where int is 32-bit wide, the eeprom command
> parse_numeric_param() routine truncates the memory address parameter to
> the lower 32-bit. Make parse_numeric_param() return long to allow
> read/write of addresses beyond the lower 4GB.
>
> Signed-off-by: Baruch Siach <baruch at tkos.co.il>
> ---
>  cmd/eeprom.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/cmd/eeprom.c b/cmd/eeprom.c
> index cdd65af763b0..614263fd8edb 100644
> --- a/cmd/eeprom.c
> +++ b/cmd/eeprom.c
> @@ -200,10 +200,10 @@ int eeprom_write(unsigned dev_addr, unsigned offset,
>         return ret;
>  }
>
> -static int parse_numeric_param(char *str)
> +static long parse_numeric_param(char *str)
>  {
>         char *endptr;
> -       int value = simple_strtol(str, &endptr, 16);
> +       long value = simple_strtol(str, &endptr, 16);
>
>         return (*endptr != '\0') ? -1 : value;
>  }
> --
> 2.35.1
>
Reviewed-by: Ramon Fried <rfried.dev at gmail.com>


More information about the U-Boot mailing list