[PATCH u-boot-marvell v2 14/20] tools: kwbimage: Add missing check for maximal value for DATA_DELAY
Stefan Roese
sr at denx.de
Thu Jan 13 07:43:18 CET 2022
On 1/12/22 18:20, Pali Rohár wrote:
> Data delay is stored as 8-bit number in kwbimage structure. Ensure the
> given value is at most 255.
>
> Signed-off-by: Pali Rohár <pali at kernel.org>
> Reviewed-by: Marek Behún <marek.behun at nic.cz>
Reviewed-by: Stefan Roese <sr at denx.de>
Thanks,
Stefan
> ---
> tools/kwbimage.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/tools/kwbimage.c b/tools/kwbimage.c
> index 7c2106006ad7..2de8c371c12a 100644
> --- a/tools/kwbimage.c
> +++ b/tools/kwbimage.c
> @@ -1659,6 +1659,10 @@ static int image_create_config_parse_oneline(char *line,
> el->regdata_delay = REGISTER_SET_HDR_OPT_DELAY_SDRAM_SETUP;
> else
> el->regdata_delay = REGISTER_SET_HDR_OPT_DELAY_MS(strtoul(value1, NULL, 10));
> + if (el->regdata_delay > 255) {
> + fprintf(stderr, "Maximal DATA_DELAY is 255\n");
> + return -1;
> + }
> break;
> case IMAGE_CFG_BAUDRATE:
> el->baudrate = strtoul(value1, NULL, 10);
>
Viele Grüße,
Stefan Roese
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr at denx.de
More information about the U-Boot
mailing list