From dae188e6839aa678f1ab4518d92b7eda7277fedf Mon Sep 17 00:00:00 2001 From: Patrick Delaunay Date: Mon, 13 Jan 2020 09:33:51 +0100 Subject: tools: ftdgrep: correct the find regions loop in do_fdtgrep Use realloc and update the loop executed in do_fdtgrep to find all the regions: only test count > max_region after the second pass. This patch solve an issue if the number of region found (count) is greater then the default value (max_region = count = 100): the second pass is never executed, because the loop stops after the first pass (i = 0, count > 100, max_regions = 100) with error -1 and the error message "Internal error with fdtgrep_find_region". I also update the error message. Signed-off-by: Patrick Delaunay --- tools/fdtgrep.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'tools') diff --git a/tools/fdtgrep.c b/tools/fdtgrep.c index 8f44f599c1c..2a8058f57fa 100644 --- a/tools/fdtgrep.c +++ b/tools/fdtgrep.c @@ -805,7 +805,7 @@ static int do_fdtgrep(struct display_info *disp, const char *filename) * we do another pass to actually record them. */ for (i = 0; i < 2; i++) { - region = malloc(count * sizeof(struct fdt_region)); + region = realloc(region, count * sizeof(struct fdt_region)); if (!region) { fprintf(stderr, "Out of memory for %d regions\n", count); @@ -823,8 +823,10 @@ static int do_fdtgrep(struct display_info *disp, const char *filename) } if (count <= max_regions) break; + } + if (count > max_regions) { free(region); - fprintf(stderr, "Internal error with fdtgrep_find_region)(\n"); + fprintf(stderr, "Internal error with fdtgrep_find_region()\n"); return -1; } -- cgit v1.3.1 From 3166014d572e614094e4d4345b738b94673b57a0 Mon Sep 17 00:00:00 2001 From: Baruch Siach Date: Wed, 22 Jan 2020 14:54:24 +0200 Subject: genboardscfg.py: drop python version comment genboardscfg.py requires python 3.x since commit 3bc14098d8fb ("genboardscfg.py: Convert to Python 3"). Cc: Masahiro Yamada Signed-off-by: Baruch Siach Acked-by: Masahiro Yamada --- tools/genboardscfg.py | 2 -- 1 file changed, 2 deletions(-) (limited to 'tools') diff --git a/tools/genboardscfg.py b/tools/genboardscfg.py index 24df13e5008..4f6382bc7ca 100755 --- a/tools/genboardscfg.py +++ b/tools/genboardscfg.py @@ -10,8 +10,6 @@ Converter from Kconfig and MAINTAINERS to a board database. Run 'tools/genboardscfg.py' to create a board database. Run 'tools/genboardscfg.py -h' for available options. - -Python 2.6 or later, but not Python 3.x is necessary to run this script. """ import errno -- cgit v1.3.1