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 master] sandbox: fix unreliable block device detection
Date: Fri, 12 Feb 2021 09:51:48 +0100	[thread overview]
Message-ID: <20210212085148.19347-1-a.fatoum@pengutronix.de> (raw)

If barebox detects that an --image file is a block device, it will try
to represent it as a block device internally as well, provided that
the user didn't explicitly specify that it should be mapped as a
character device instead. The hf_info::is_cdev member used to indicate
this override wasn't initialized though, so detection was unreliable,
Fix this.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/sandbox/os/common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/sandbox/os/common.c b/arch/sandbox/os/common.c
index da87be29c74d..56c2d0519388 100644
--- a/arch/sandbox/os/common.c
+++ b/arch/sandbox/os/common.c
@@ -276,7 +276,7 @@ extern char * strsep_unescaped(char **s, const char *ct);
 
 static int add_image(const char *_str, char *devname_template, int *devname_number)
 {
-	struct hf_info *hf = malloc(sizeof(struct hf_info));
+	struct hf_info *hf = calloc(1, sizeof(struct hf_info));
 	char *str, *filename, *devname;
 	char tmp[16];
 	char *opt;
-- 
2.29.2


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

             reply	other threads:[~2021-02-12  8:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-12  8:51 Ahmad Fatoum [this message]
2021-02-12  9:00 ` 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=20210212085148.19347-1-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