mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Lucas Stach <l.stach@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 1/2] uncompress: use read_full to fill decompression buffer
Date: Tue, 25 May 2021 20:37:32 +0200	[thread overview]
Message-ID: <20210525183733.3345497-1-l.stach@pengutronix.de> (raw)

The decompression algorithms want all of the requested buffer size
to be filled and don't cope with less bytes being returned.
Use read_full to satisfy this requirement.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
 lib/uncompress.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/uncompress.c b/lib/uncompress.c
index c47d319dbb5f..5c0d1e9f4d66 100644
--- a/lib/uncompress.c
+++ b/lib/uncompress.c
@@ -24,6 +24,7 @@
 #include <filetype.h>
 #include <malloc.h>
 #include <fs.h>
+#include <libfile.h>
 
 static void *uncompress_buf;
 static unsigned int uncompress_size;
@@ -142,7 +143,7 @@ static int uncompress_infd, uncompress_outfd;
 
 static int fill_fd(void *buf, unsigned int len)
 {
-	return read(uncompress_infd, buf, len);
+	return read_full(uncompress_infd, buf, len);
 }
 
 static int flush_fd(void *buf, unsigned int len)
-- 
2.29.2


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


             reply	other threads:[~2021-05-25 19:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-25 18:37 Lucas Stach [this message]
2021-05-25 18:37 ` [PATCH 2/2] bootm: add support for booting compressed images Lucas Stach
2021-05-26  5:42   ` Sascha Hauer
2021-05-26  9:17   ` Ahmad Fatoum
2021-05-26  9:39     ` Lucas Stach
2021-05-26  9:41       ` Ahmad Fatoum
2021-05-26  9:58         ` Lucas Stach
2021-05-26 10:04           ` Ahmad Fatoum

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=20210525183733.3345497-1-l.stach@pengutronix.de \
    --to=l.stach@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --subject='Re: [PATCH 1/2] uncompress: use read_full to fill decompression buffer' \
    /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

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