mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] arch/arm/lib/bootm: fix length check of kernel image
@ 2014-07-21 10:43 basti
  2014-07-22  5:38 ` Sascha Hauer
  0 siblings, 1 reply; 4+ messages in thread
From: basti @ 2014-07-21 10:43 UTC (permalink / raw)
  To: barebox

Signed-off-by: Sebastian Block <basti@linux-source.de>
---
  arch/arm/lib/bootm.c |    2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c
index 4896d01..d9b9111 100644
--- a/arch/arm/lib/bootm.c
+++ b/arch/arm/lib/bootm.c
@@ -314,7 +314,7 @@ static int do_bootz_linux(struct image_data *data)
  			image_size - sizeof(*header));
  	if (ret < 0)
  		goto err_out;
-	if (ret < end - sizeof(*header)) {
+	if (ret < image_size - sizeof(*header)) {
  		printf("premature end of image\n");
  		ret = -EIO;
  		goto err_out;
-- 
1.7.10.4


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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] arch/arm/lib/bootm: fix length check of kernel image
  2014-07-21 10:43 [PATCH] arch/arm/lib/bootm: fix length check of kernel image basti
@ 2014-07-22  5:38 ` Sascha Hauer
  2014-07-22  7:38   ` Lucas Stach
       [not found]   ` <94dc023fe4dffc56144a4d26532aff05@linux-source.de>
  0 siblings, 2 replies; 4+ messages in thread
From: Sascha Hauer @ 2014-07-22  5:38 UTC (permalink / raw)
  To: basti; +Cc: barebox

Hi Sebastian,

On Mon, Jul 21, 2014 at 12:43:13PM +0200, basti@linux-source.de wrote:
> Signed-off-by: Sebastian Block <basti@linux-source.de>
> ---
>  arch/arm/lib/bootm.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c
> index 4896d01..d9b9111 100644
> --- a/arch/arm/lib/bootm.c
> +++ b/arch/arm/lib/bootm.c
> @@ -314,7 +314,7 @@ static int do_bootz_linux(struct image_data *data)
>  			image_size - sizeof(*header));
>  	if (ret < 0)
>  		goto err_out;
> -	if (ret < end - sizeof(*header)) {
> +	if (ret < image_size - sizeof(*header)) {

Did this cause any real trouble? I was quite surprised when I saw that
patch. After a test I saw that for me 'image_size' has the same value as
'end'.

The patch is obviously correct and will be applied, I'm just not sure if
it's an important fix or a cleanup change.

Sascha

-- 
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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] arch/arm/lib/bootm: fix length check of kernel image
  2014-07-22  5:38 ` Sascha Hauer
@ 2014-07-22  7:38   ` Lucas Stach
       [not found]   ` <94dc023fe4dffc56144a4d26532aff05@linux-source.de>
  1 sibling, 0 replies; 4+ messages in thread
From: Lucas Stach @ 2014-07-22  7:38 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

Am Dienstag, den 22.07.2014, 07:38 +0200 schrieb Sascha Hauer:
> Hi Sebastian,
> 
> On Mon, Jul 21, 2014 at 12:43:13PM +0200, basti@linux-source.de wrote:
> > Signed-off-by: Sebastian Block <basti@linux-source.de>
> > ---
> >  arch/arm/lib/bootm.c |    2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c
> > index 4896d01..d9b9111 100644
> > --- a/arch/arm/lib/bootm.c
> > +++ b/arch/arm/lib/bootm.c
> > @@ -314,7 +314,7 @@ static int do_bootz_linux(struct image_data *data)
> >  			image_size - sizeof(*header));
> >  	if (ret < 0)
> >  		goto err_out;
> > -	if (ret < end - sizeof(*header)) {
> > +	if (ret < image_size - sizeof(*header)) {
> 
> Did this cause any real trouble? I was quite surprised when I saw that
> patch. After a test I saw that for me 'image_size' has the same value as
> 'end'.
> 
> The patch is obviously correct and will be applied, I'm just not sure if
> it's an important fix or a cleanup change.
> 
I don't think this qualifies as a critical fix, as before the
introduction of this 'image_size' variable we always used 'end' as the
size of the image without running into any problems. So I think this is
only a correctness fix.

Regards,
Lucas

-- 
Pengutronix e.K.             | Lucas Stach                 |
Industrial Linux Solutions   | http://www.pengutronix.de/  |


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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] arch/arm/lib/bootm: fix length check of kernel image
       [not found]   ` <94dc023fe4dffc56144a4d26532aff05@linux-source.de>
@ 2014-07-22 19:45     ` Sascha Hauer
  0 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2014-07-22 19:45 UTC (permalink / raw)
  To: basti; +Cc: barebox

On Tue, Jul 22, 2014 at 11:14:26AM +0200, basti@linux-source.de wrote:
> Hi Sascha,

(Adding back the list to Cc)

> 
> >>Signed-off-by: Sebastian Block <basti@linux-source.de>
> >>---
> >> arch/arm/lib/bootm.c |    2 +-
> >> 1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >>diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c
> >>index 4896d01..d9b9111 100644
> >>--- a/arch/arm/lib/bootm.c
> >>+++ b/arch/arm/lib/bootm.c
> >>@@ -314,7 +314,7 @@ static int do_bootz_linux(struct image_data *data)
> >> 			image_size - sizeof(*header));
> >> 	if (ret < 0)
> >> 		goto err_out;
> >>-	if (ret < end - sizeof(*header)) {
> >>+	if (ret < image_size - sizeof(*header)) {
> >
> >Did this cause any real trouble? I was quite surprised when I saw that
> >patch. After a test I saw that for me 'image_size' has the same
> >value as
> >'end'.
> 
> I run into trouble with it, caused by variable end contains memory
> address of the image not the size as returned by read_full.

Hm, this must have something to do with your kernel configuration. Maybe
you have CONFIG_ARM_PATCH_PHYS_VIRT disabled in your kernel.

Anyway, applied this patch to current master.

Sascha

-- 
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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-07-22 19:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-21 10:43 [PATCH] arch/arm/lib/bootm: fix length check of kernel image basti
2014-07-22  5:38 ` Sascha Hauer
2014-07-22  7:38   ` Lucas Stach
     [not found]   ` <94dc023fe4dffc56144a4d26532aff05@linux-source.de>
2014-07-22 19:45     ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox