[PATCH 2/3] mkimage: fit: do not ignore fdt_setprop return code
Quentin Schulz
foss+uboot at 0leil.net
Tue Sep 23 12:27:21 CEST 2025
From: Quentin Schulz <quentin.schulz at cherry.de>
All explicit calls to fdt_setprop* in tools/ are checked except those
three. Let's add a check for the return code of fdt_setprop_u32() calls.
Signed-off-by: Quentin Schulz <quentin.schulz at cherry.de>
---
tools/fit_image.c | 22 +++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
diff --git a/tools/fit_image.c b/tools/fit_image.c
index 88a9060256a1acc0f33c084fb6fad241d160b0fa..41c386bdc9c8e01a66ee8f62e0e7116e47a68bd8 100644
--- a/tools/fit_image.c
+++ b/tools/fit_image.c
@@ -610,13 +610,25 @@ static int fit_extract_data(struct image_tool_params *params, const char *fname)
}
if (params->external_offset > 0) {
/* An external offset positions the data absolutely. */
- fdt_setprop_u32(fdt, node, FIT_DATA_POSITION_PROP,
- params->external_offset + buf_ptr);
+ ret = fdt_setprop_u32(fdt, node, FIT_DATA_POSITION_PROP,
+ params->external_offset + buf_ptr);
} else {
- fdt_setprop_u32(fdt, node, FIT_DATA_OFFSET_PROP,
- buf_ptr);
+ ret = fdt_setprop_u32(fdt, node, FIT_DATA_OFFSET_PROP,
+ buf_ptr);
}
- fdt_setprop_u32(fdt, node, FIT_DATA_SIZE_PROP, len);
+
+ if (ret) {
+ ret = -EINVAL;
+ goto err_munmap;
+ }
+
+ ret = fdt_setprop_u32(fdt, node, FIT_DATA_SIZE_PROP, len);
+
+ if (ret) {
+ ret = -EINVAL;
+ goto err_munmap;
+ }
+
buf_ptr += ALIGN(len, align_size);
}
--
2.51.0
More information about the U-Boot
mailing list