summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQuentin Schulz <[email protected]>2025-09-23 12:27:21 +0200
committerTom Rini <[email protected]>2025-10-10 13:28:36 -0600
commitabab733fc24158f0195967e5b6fc69a0de4658a3 (patch)
treea3326a056e933bf9f6af0ce392d2a25fc86e0790
parent6209ce58c3711a5ccdcd080651e604ba8fd3a067 (diff)
mkimage: fit: do not ignore fdt_setprop return code
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 <[email protected]>
-rw-r--r--tools/fit_image.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/tools/fit_image.c b/tools/fit_image.c
index 7e2a12aa7d0..d026f6ff9c8 100644
--- a/tools/fit_image.c
+++ b/tools/fit_image.c
@@ -658,13 +658,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);
}