aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorPali Rohár2022-01-12 18:20:48 +0100
committerStefan Roese2022-01-14 11:39:16 +0100
commitfdcae2615639454f6c2b7c787de49e74e8746d07 (patch)
tree39ce906132cc03428b6ee05dd56b17382f78e234 /tools
parent18d85d6e8ad766de9dd35c4d5c0d984233fb9b21 (diff)
tools: kwbimage: Add missing check for maximal value for DATA_DELAY
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@kernel.org> Reviewed-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Stefan Roese <sr@denx.de>
Diffstat (limited to 'tools')
-rw-r--r--tools/kwbimage.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/kwbimage.c b/tools/kwbimage.c
index 7c2106006ad..2de8c371c12 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);