[PATCH] image-host: Fix error value paths and emit error messages to stderr.
Heinrich Schuchardt
xypron.glpk at gmx.de
Sun Jan 28 09:36:32 CET 2024
On 1/23/24 09:15, Hugo Cornelis wrote:
Thanks Hugo for addressing the issue. Could you, please, resend the
patch with an appropriate commit message. Please, use
scripts/get_maintainers.pl to determine the list of addressees.
Otherwise the patch looks good to me.
The initial assignment in fit_image_read_key_iv_data()
int ret = -1;
is superfluous. You may want to fix that too
It helps to know which patch introduced the problem. Please, add
Fixes: bc01d9ff93f3 ("image-host: refactor and protect for very long
filenames")
Best regards
Heinrich
> Signed-off-by: Hugo Cornelis <hugo.cornelis at essensium.com>
> ---
> tools/image-host.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/tools/image-host.c b/tools/image-host.c
> index b2a0f2e6d1..06b05dcacb 100644
> --- a/tools/image-host.c
> +++ b/tools/image-host.c
> @@ -351,12 +351,12 @@ static int fit_image_read_key_iv_data(const char *keydir, const char *key_iv_nam
> ret = snprintf(filename, sizeof(filename), "%s/%s%s",
> keydir, key_iv_name, ".bin");
> if (ret >= sizeof(filename)) {
> - printf("Can't format the key or IV filename when setting up the cipher: insufficient buffer space\n");
> - ret = -1;
> + fprintf(stderr, "Can't format the key or IV filename when setting up the cipher: insufficient buffer space\n");
> + return -1;
> }
> if (ret < 0) {
> - printf("Can't format the key or IV filename when setting up the cipher: snprintf error\n");
> - ret = -1;
> + fprintf(stderr, "Can't format the key or IV filename when setting up the cipher: snprintf error\n");
> + return -1;
> }
>
> ret = fit_image_read_data(filename, key_iv_data, expected_size);
More information about the U-Boot
mailing list