diff mbox series

[2/2] tools/fit-image: print a warning when cmd-line for dtc might be truncated

Message ID 20200427000839.26473-3-devel-sven@geroedel.de
State Accepted
Commit ea5d3731b843b14f1c48d0d0f2c7d2877ecbf673
Headers show
Series mkimage: fix using long pathnames | expand

Commit Message

Sven Roederer April 27, 2020, 12:08 a.m. UTC
Signed-off-by: Sven Roederer <devel-sven at geroedel.de>
---
 tools/fit_image.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Tom Rini May 1, 2020, 9:57 p.m. UTC | #1
On Mon, Apr 27, 2020 at 02:08:39AM +0200, Sven Roederer wrote:

> Signed-off-by: Sven Roederer <devel-sven at geroedel.de>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/tools/fit_image.c b/tools/fit_image.c
index 4aeabbcfe9..88ff093d05 100644
--- a/tools/fit_image.c
+++ b/tools/fit_image.c
@@ -17,6 +17,7 @@ 
 #include "fit_common.h"
 #include "mkimage.h"
 #include <image.h>
+#include <string.h>
 #include <stdarg.h>
 #include <version.h>
 #include <u-boot/crc.h>
@@ -744,6 +745,9 @@  static int fit_handle_file(struct image_tool_params *params)
 		snprintf(cmd, sizeof(cmd), "cp \"%s\" \"%s\"",
 			 params->imagefile, tmpfile);
 	}
+	if (strlen(cmd) >= MKIMAGE_MAX_DTC_CMDLINE_LEN - 1) {
+		fprintf(stderr, "WARNING: command-line for FIT creation might be truncated and will probably fail.\n");
+	}
 
 	if (*cmd && system(cmd) == -1) {
 		fprintf (stderr, "%s: system(%s) failed: %s\n",