mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH master] sandbox: fix unreliable block device detection
@ 2021-02-12  8:51 Ahmad Fatoum
  2021-02-12  9:00 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2021-02-12  8:51 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

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

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

* Re: [PATCH master] sandbox: fix unreliable block device detection
  2021-02-12  8:51 [PATCH master] sandbox: fix unreliable block device detection Ahmad Fatoum
@ 2021-02-12  9:00 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2021-02-12  9:00 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox

On Fri, Feb 12, 2021 at 09:51:48AM +0100, Ahmad Fatoum wrote:
> 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(-)

Applied, thanks

Sascha

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

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

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

end of thread, other threads:[~2021-02-12  9:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-12  8:51 [PATCH master] sandbox: fix unreliable block device detection Ahmad Fatoum
2021-02-12  9:00 ` Sascha Hauer

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