[U-Boot] [PATCH 1/1] efi_loader: endless loop in add_strings_package()

Heinrich Schuchardt xypron.glpk at gmx.de
Tue Mar 19 11:40:33 UTC 2019


Avoid an endless loop in add_strings_package().

Fixes Coverity CID 185833

Suggested-by: Takahiro Akashi <takahiro.akashi at linaro.org>
Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
---
 lib/efi_loader/efi_hii.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/lib/efi_loader/efi_hii.c b/lib/efi_loader/efi_hii.c
index 3a966fa4dff..61b71dec621 100644
--- a/lib/efi_loader/efi_hii.c
+++ b/lib/efi_loader/efi_hii.c
@@ -227,9 +227,8 @@ out:
 error:
 	if (stbl) {
 		free(stbl->language);
-		if (idx > 0)
-			while (--idx >= 0)
-				free(stbl->strings[idx].string);
+		while (idx > 0)
+			free(stbl->strings[--idx].string);
 		free(stbl->strings);
 	}
 	free(stbl);
--
2.20.1



More information about the U-Boot mailing list