diff options
| author | Quentin Schulz <[email protected]> | 2025-09-23 12:27:21 +0200 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2025-10-10 13:28:36 -0600 |
| commit | abab733fc24158f0195967e5b6fc69a0de4658a3 (patch) | |
| tree | a3326a056e933bf9f6af0ce392d2a25fc86e0790 | |
| parent | 6209ce58c3711a5ccdcd080651e604ba8fd3a067 (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.c | 22 |
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); } |
