mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH v2 1/2] uncompress: use read_full to fill decompression buffer
@ 2021-05-26  9:02 Lucas Stach
  2021-05-26  9:02 ` [PATCH v2 2/2] bootm: add support for booting compressed images Lucas Stach
  2021-05-27  6:50 ` [PATCH v2 1/2] uncompress: use read_full to fill decompression buffer Sascha Hauer
  0 siblings, 2 replies; 4+ messages in thread
From: Lucas Stach @ 2021-05-26  9:02 UTC (permalink / raw)
  To: barebox

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


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

end of thread, other threads:[~2021-05-28  7:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-26  9:02 [PATCH v2 1/2] uncompress: use read_full to fill decompression buffer Lucas Stach
2021-05-26  9:02 ` [PATCH v2 2/2] bootm: add support for booting compressed images Lucas Stach
2021-05-28  7:06   ` Ahmad Fatoum
2021-05-27  6:50 ` [PATCH v2 1/2] uncompress: use read_full to fill decompression buffer Sascha Hauer

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