mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 2/5] scripts: kwboot: allow piping full buffer size at once
Date: Thu,  1 Oct 2020 09:43:34 +0200	[thread overview]
Message-ID: <20201001074337.23430-2-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20201001074337.23430-1-a.fatoum@pengutronix.de>

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


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

  reply	other threads:[~2020-10-01  7:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-01  7:43 [PATCH 1/5] treewide: fix unterminated of_device_id[] reported by Coccinelle Ahmad Fatoum
2020-10-01  7:43 ` Ahmad Fatoum [this message]
2020-10-01  7:43 ` [PATCH 3/5] ARM: layerscape: ppa: fix wrong return values on some errors Ahmad Fatoum
2020-10-01  7:43 ` [PATCH 4/5] net: macb: " Ahmad Fatoum
2020-10-01  7:43 ` [PATCH 5/5] scripts: kwbimage: " Ahmad Fatoum
2020-10-02  4:31 ` [PATCH 1/5] treewide: fix unterminated of_device_id[] reported by Coccinelle Sascha Hauer

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=20201001074337.23430-2-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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