[PATCH 2/5] scripts: kwboot: allow piping full buffer size at once

Ahmad Fatoum a.fatoum at pengutronix.de
Thu Oct 1 03:43:34 EDT 2020


While buf == _buf, their type and sizeof differ. The read syscall should
have the buffer size as argument, but instead got the pointer's size.

This likely doesn't change high-level behavior, because read was called
in a loop, so fix this.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 scripts/kwboot.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/kwboot.c b/scripts/kwboot.c
index 43b8b8cbcdc6..60e8a69d187d 100644
--- a/scripts/kwboot.c
+++ b/scripts/kwboot.c
@@ -504,7 +504,7 @@ kwboot_term_pipe(int in, int out, char *quit, int *s)
 	ssize_t nin, nout;
 	char _buf[128], *buf = _buf;
 
-	nin = read(in, buf, sizeof(buf));
+	nin = read(in, _buf, sizeof(_buf));
 	if (nin < 0)
 		return -1;
 
-- 
2.28.0




More information about the barebox mailing list