diff mbox series

[1/3] imx: hab: Allow hab_auth_img_or_fail to be called without ivt_offset

Message ID 20230907014727.371324-1-festevam@gmail.com
State Accepted
Commit 2ec9ebc72a432f9b7b6631cb9666245f776cc256
Delegated to: Stefano Babic
Headers show
Series [1/3] imx: hab: Allow hab_auth_img_or_fail to be called without ivt_offset | expand

Commit Message

Fabio Estevam Sept. 7, 2023, 1:47 a.m. UTC
From: Eduard Strehlau <eduard@lionizers.com>

Since commit ea91031b2232 ("imx: hab: extend hab_auth_img to calculate
ivt_offset"), it is possible to call the hab_auth_img command without the 
last ivt_offset argument.

Currently, calling hab_auth_img_or_fail without the last
ivt_offset parameter causes a failure and the command usage text is shown.

Fix this problem by adjusting the argc logic to allow
calling hab_auth_img_or_fail with only the address and size parameters.

This way, both hab_auth_img and hab_auth_img_or_fail have the same
behavior with respect to the allowed number of command parameters.
 
Signed-off-by: Eduard Strehlau <eduard@lionizers.com>
Signed-off-by: Fabio Estevam <festevam@denx.de>
---
 arch/arm/mach-imx/hab.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Stefano Babic Sept. 23, 2023, 6:51 p.m. UTC | #1
> From: Eduard Strehlau <eduard@lionizers.com>
> Since commit ea91031b2232 ("imx: hab: extend hab_auth_img to calculate
> ivt_offset"), it is possible to call the hab_auth_img command without the 
> last ivt_offset argument.
> Currently, calling hab_auth_img_or_fail without the last
> ivt_offset parameter causes a failure and the command usage text is shown.
> Fix this problem by adjusting the argc logic to allow
> calling hab_auth_img_or_fail with only the address and size parameters.
> This way, both hab_auth_img and hab_auth_img_or_fail have the same
> behavior with respect to the allowed number of command parameters.
>  
> Signed-off-by: Eduard Strehlau <eduard@lionizers.com>
> Signed-off-by: Fabio Estevam <festevam@denx.de>
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic
diff mbox series

Patch

diff --git a/arch/arm/mach-imx/hab.c b/arch/arm/mach-imx/hab.c
index 439cdaf07a7c..6cacca069d9f 100644
--- a/arch/arm/mach-imx/hab.c
+++ b/arch/arm/mach-imx/hab.c
@@ -659,7 +659,7 @@  static int do_authenticate_image_or_failover(struct cmd_tbl *cmdtp, int flag,
 {
 	int ret = CMD_RET_FAILURE;
 
-	if (argc != 4) {
+	if (argc < 3) {
 		ret = CMD_RET_USAGE;
 		goto error;
 	}