All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] stm32mp: stm32prog: fix the last character of dfu_alt_add third parameter
@ 2022-06-16 16:37 Patrick Delaunay
  2022-06-17  6:01 ` Patrice CHOTARD
  2022-06-17  7:34 ` Patrick DELAUNAY
  0 siblings, 2 replies; 3+ messages in thread
From: Patrick Delaunay @ 2022-06-16 16:37 UTC (permalink / raw)
  To: u-boot
  Cc: Patrick Delaunay, Jaehoon Chung, Masami Hiramatsu,
	Patrice Chotard, Simon Glass, U-Boot STM32

The third parameter of dfu_alt_add(), the string description of alternate,
is build in stm32prog_alt_add() with a unnecessary character ';' at the
end of the string.

This separator was required in the first implementation of
dfu_alt_add() but is no more needed in the current implementation;
this separator is managed only in dfu_config_interfaces() which call
dfu_alt_add() for this parameter without this separator.

And since the commit 53b406369e9d ("DFU: Check the number of arguments
and argument string strictly"), this added character cause an error when
the stm32prog command is executed because the third parameter of
dfu_alt_add() must be a string with a numerical value; 's' must be NULL
in the result of call in dfu_fill_entity_mmc():
  third_arg = simple_strtoul(argv[2], &s, 0);

Fixes: 53b406369e9d ("DFU: Check the number of arguments and argument string strictly")
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
---

 arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c
index b7111123ba..c391b6c7ab 100644
--- a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c
+++ b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c
@@ -1262,7 +1262,7 @@ static int stm32prog_alt_add(struct stm32prog_data *data,
 				   "raw 0x%llx 0x%llx",
 				   part->addr, nb_blk);
 		offset += snprintf(buf + offset, ALT_BUF_LEN - offset,
-				   " mmcpart %d;", -(part->part_id));
+				   " mmcpart %d", -(part->part_id));
 	} else {
 		if (part->part_type == PART_SYSTEM &&
 		    (part->target == STM32PROG_NAND ||
@@ -1280,7 +1280,7 @@ static int stm32prog_alt_add(struct stm32prog_data *data,
 			offset += snprintf(buf + offset, ALT_BUF_LEN - offset,
 					   " %d", part->dev_id);
 		offset += snprintf(buf + offset, ALT_BUF_LEN - offset,
-				   " %d;", part->part_id);
+				   " %d", part->part_id);
 	}
 	ret = -ENODEV;
 	switch (part->target) {
-- 
2.25.1


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

* Re: [PATCH] stm32mp: stm32prog: fix the last character of dfu_alt_add third parameter
  2022-06-16 16:37 [PATCH] stm32mp: stm32prog: fix the last character of dfu_alt_add third parameter Patrick Delaunay
@ 2022-06-17  6:01 ` Patrice CHOTARD
  2022-06-17  7:34 ` Patrick DELAUNAY
  1 sibling, 0 replies; 3+ messages in thread
From: Patrice CHOTARD @ 2022-06-17  6:01 UTC (permalink / raw)
  To: Patrick Delaunay, u-boot
  Cc: Jaehoon Chung, Masami Hiramatsu, Simon Glass, U-Boot STM32

Hi Patrick

On 6/16/22 18:37, Patrick Delaunay wrote:
> The third parameter of dfu_alt_add(), the string description of alternate,
> is build in stm32prog_alt_add() with a unnecessary character ';' at the
> end of the string.
> 
> This separator was required in the first implementation of
> dfu_alt_add() but is no more needed in the current implementation;
> this separator is managed only in dfu_config_interfaces() which call
> dfu_alt_add() for this parameter without this separator.
> 
> And since the commit 53b406369e9d ("DFU: Check the number of arguments
> and argument string strictly"), this added character cause an error when
> the stm32prog command is executed because the third parameter of
> dfu_alt_add() must be a string with a numerical value; 's' must be NULL
> in the result of call in dfu_fill_entity_mmc():
>   third_arg = simple_strtoul(argv[2], &s, 0);
> 
> Fixes: 53b406369e9d ("DFU: Check the number of arguments and argument string strictly")
> Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
> ---
> 
>  arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c
> index b7111123ba..c391b6c7ab 100644
> --- a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c
> +++ b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c
> @@ -1262,7 +1262,7 @@ static int stm32prog_alt_add(struct stm32prog_data *data,
>  				   "raw 0x%llx 0x%llx",
>  				   part->addr, nb_blk);
>  		offset += snprintf(buf + offset, ALT_BUF_LEN - offset,
> -				   " mmcpart %d;", -(part->part_id));
> +				   " mmcpart %d", -(part->part_id));
>  	} else {
>  		if (part->part_type == PART_SYSTEM &&
>  		    (part->target == STM32PROG_NAND ||
> @@ -1280,7 +1280,7 @@ static int stm32prog_alt_add(struct stm32prog_data *data,
>  			offset += snprintf(buf + offset, ALT_BUF_LEN - offset,
>  					   " %d", part->dev_id);
>  		offset += snprintf(buf + offset, ALT_BUF_LEN - offset,
> -				   " %d;", part->part_id);
> +				   " %d", part->part_id);
>  	}
>  	ret = -ENODEV;
>  	switch (part->target) {

Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>

Thanks
Patrice

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

* Re: [PATCH] stm32mp: stm32prog: fix the last character of dfu_alt_add third parameter
  2022-06-16 16:37 [PATCH] stm32mp: stm32prog: fix the last character of dfu_alt_add third parameter Patrick Delaunay
  2022-06-17  6:01 ` Patrice CHOTARD
@ 2022-06-17  7:34 ` Patrick DELAUNAY
  1 sibling, 0 replies; 3+ messages in thread
From: Patrick DELAUNAY @ 2022-06-17  7:34 UTC (permalink / raw)
  To: u-boot
  Cc: Jaehoon Chung, Masami Hiramatsu, Patrice Chotard, Simon Glass,
	U-Boot STM32

Hi,

On 6/16/22 18:37, Patrick Delaunay wrote:
> The third parameter of dfu_alt_add(), the string description of alternate,
> is build in stm32prog_alt_add() with a unnecessary character ';' at the
> end of the string.
>
> This separator was required in the first implementation of
> dfu_alt_add() but is no more needed in the current implementation;
> this separator is managed only in dfu_config_interfaces() which call
> dfu_alt_add() for this parameter without this separator.
>
> And since the commit 53b406369e9d ("DFU: Check the number of arguments
> and argument string strictly"), this added character cause an error when
> the stm32prog command is executed because the third parameter of
> dfu_alt_add() must be a string with a numerical value; 's' must be NULL
> in the result of call in dfu_fill_entity_mmc():
>    third_arg = simple_strtoul(argv[2], &s, 0);
>
> Fixes: 53b406369e9d ("DFU: Check the number of arguments and argument string strictly")
> Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
> ---
>
>   arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)


Applied to u-boot-stm/master, thanks!

Regards
Patrick



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

end of thread, other threads:[~2022-06-17  7:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-16 16:37 [PATCH] stm32mp: stm32prog: fix the last character of dfu_alt_add third parameter Patrick Delaunay
2022-06-17  6:01 ` Patrice CHOTARD
2022-06-17  7:34 ` Patrick DELAUNAY

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.