mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Lucas Stach <l.stach@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH] arm: bootm: don't fall over if image is padded with less than 40 bytes
Date: Mon, 23 Oct 2017 09:13:34 +0200	[thread overview]
Message-ID: <20171023071334.lu5u2sxvngjq6rpx@pengutronix.de> (raw)
In-Reply-To: <20171020170056.10893-1-l.stach@pengutronix.de>

On Fri, Oct 20, 2017 at 07:00:56PM +0200, Lucas Stach wrote:
> If the zImage has a padding, which is less than 40 bytes
> (sizeof struct fdt_header) the amount of read bytes would be propagated
> as an error code. Fix this by only propagating real errors and treating
> failure to read less than the expected amount as no concatenated DT
> being present.
> 
> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
> ---

Applied, thanks

Sascha

>  arch/arm/lib/bootm.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c
> index 8068a53be0a5..25efb42541f9 100644
> --- a/arch/arm/lib/bootm.c
> +++ b/arch/arm/lib/bootm.c
> @@ -250,8 +250,10 @@ static int do_bootz_linux_fdt(int fd, struct image_data *data)
>  
>  	header = &__header;
>  	ret = read(fd, header, sizeof(*header));
> -	if (ret < sizeof(*header))
> +	if (ret < 0)
>  		return ret;
> +	if (ret < sizeof(*header))
> +		return -ENXIO;
>  
>  	if (file_detect_type(header, sizeof(*header)) != filetype_oftree)
>  		return -ENXIO;
> -- 
> 2.11.0
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

      reply	other threads:[~2017-10-23  7:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-20 17:00 Lucas Stach
2017-10-23  7:13 ` Sascha Hauer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171023071334.lu5u2sxvngjq6rpx@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=l.stach@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox