From mboxrd@z Thu Jan 1 00:00:00 1970 From: Heiko Stuebner Date: Fri, 19 Jun 2020 12:47:01 +0200 Subject: [PATCH v3 2/5] mkimage: fit_image: handle multiple errors when writing signatures In-Reply-To: References: <20200526104412.3666210-1-heiko@sntech.de> <20200526104412.3666210-3-heiko@sntech.de> Message-ID: <8657654.VsHI1tnm3i@phil> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Am Sonntag, 31. Mai 2020, 16:07:56 CEST schrieb Simon Glass: > Hi Heiko, > > On Tue, 26 May 2020 at 04:44, Heiko Stuebner wrote: > > > > From: Heiko Stuebner > > > > fit_image_write_sig() contains mostly functions from libfdt that > > return FDT_ERR_foo errors but also a call to fit_set_timestamp() > > which returns a regular error. > > > > When handling the size increase via multiple iterations, check > > for both -FDT_ERR_NOSPACE but also for -ENOSPC. > > > > There is no real conflict, as FDT_ERR_NOSPACE = 3 = ESRCH > > (No such process) and ENOSPC = 28 which is above any FDT_ERR_*. > > > > Signed-off-by: Heiko Stuebner > > Reviewed-by: Simon Glass > > Reviewed-by: Kever Yang > > --- > > tools/image-host.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > Changing my mind on this - I wonder if we can change > fit_image_write_sig() to always return an errno code, never an FDT > code? Could be a follow-on patch. I'll take that suggestion and do a followup with this suggestion, simply because this may open up additional discussion. Heiko > > diff --git a/tools/image-host.c b/tools/image-host.c > > index 9a83b7f675..baf9590f3b 100644 > > --- a/tools/image-host.c > > +++ b/tools/image-host.c > > @@ -241,7 +241,7 @@ static int fit_image_process_sig(const char *keydir, void *keydest, > > ret = fit_image_write_sig(fit, noffset, value, value_len, comment, > > NULL, 0, cmdname); > > if (ret) { > > - if (ret == -FDT_ERR_NOSPACE) > > + if (ret == -FDT_ERR_NOSPACE || ret == -ENOSPC) > > return -ENOSPC; > > printf("Can't write signature for '%s' signature node in '%s' conf node: %s\n", > > node_name, image_name, fdt_strerror(ret)); > > -- > > 2.25.1 > > > > Regards, > Simon >