[U-Boot] [PATCH] cmd: part: number: return hexadecimal value

From: Roman Stratiienko roman.stratiienko@globallogic.com
At this point we are using part number sub-command to retrieve UUID of the partition using it's name.
e.g.: part number mmc $mmcdev system_a system_a_index part uuid mmc $mmcdev:${system_a_index} system_a_uuid
Since 'part uuid' sub-command expects partition index in hex format and 'part number' returns decimal value, 'part uuid' command will provide wrong UUID or fail.
Fixes: be683756f62034 ("cmd: part: Add 'number' sub-command") Cc: Dirk Behme dirk.behme@de.bosch.com Reported-by: Pontus Fuchs pontus.fuchs@se.bosch.com Signed-off-by: Roman Stratiienko roman.stratiienko@globallogic.com Signed-off-by: Eugeniu Rosca erosca@de.adit-jv.com --- cmd/part.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cmd/part.c b/cmd/part.c index 6cfb67b27959..5e4e45ca6d8b 100644 --- a/cmd/part.c +++ b/cmd/part.c @@ -152,7 +152,7 @@ static int do_part_info(int argc, char * const argv[], enum cmd_part_info param) snprintf(buf, sizeof(buf), LBAF, info.size); break; case CMD_PART_INFO_NUMBER: - snprintf(buf, sizeof(buf), "%d", part); + snprintf(buf, sizeof(buf), "0x%x", part); break; default: printf("** Unknown cmd_part_info value: %d\n", param);

On Fri, Sep 20, 2019 at 03:59:18PM +0200, Eugeniu Rosca wrote:
From: Roman Stratiienko roman.stratiienko@globallogic.com
At this point we are using part number sub-command to retrieve UUID of the partition using it's name.
e.g.: part number mmc $mmcdev system_a system_a_index part uuid mmc $mmcdev:${system_a_index} system_a_uuid
Since 'part uuid' sub-command expects partition index in hex format and 'part number' returns decimal value, 'part uuid' command will provide wrong UUID or fail.
Fixes: be683756f62034 ("cmd: part: Add 'number' sub-command") Cc: Dirk Behme dirk.behme@de.bosch.com Reported-by: Pontus Fuchs pontus.fuchs@se.bosch.com Signed-off-by: Roman Stratiienko roman.stratiienko@globallogic.com Signed-off-by: Eugeniu Rosca erosca@de.adit-jv.com
Reviewed-by: Tom Rini trini@konsulko.com

On Fri, Sep 20, 2019 at 4:59 PM Eugeniu Rosca erosca@de.adit-jv.com wrote:
From: Roman Stratiienko roman.stratiienko@globallogic.com
At this point we are using part number sub-command to retrieve UUID of the partition using it's name.
e.g.: part number mmc $mmcdev system_a system_a_index part uuid mmc $mmcdev:${system_a_index} system_a_uuid
Since 'part uuid' sub-command expects partition index in hex format and 'part number' returns decimal value, 'part uuid' command will provide wrong UUID or fail.
Fixes: be683756f62034 ("cmd: part: Add 'number' sub-command") Cc: Dirk Behme dirk.behme@de.bosch.com Reported-by: Pontus Fuchs pontus.fuchs@se.bosch.com Signed-off-by: Roman Stratiienko roman.stratiienko@globallogic.com Signed-off-by: Eugeniu Rosca erosca@de.adit-jv.com
cmd/part.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cmd/part.c b/cmd/part.c index 6cfb67b27959..5e4e45ca6d8b 100644 --- a/cmd/part.c +++ b/cmd/part.c @@ -152,7 +152,7 @@ static int do_part_info(int argc, char * const argv[], enum cmd_part_info param) snprintf(buf, sizeof(buf), LBAF, info.size); break; case CMD_PART_INFO_NUMBER:
snprintf(buf, sizeof(buf), "%d", part);
snprintf(buf, sizeof(buf), "0x%x", part); break; default: printf("** Unknown cmd_part_info value: %d\n", param);
-- 2.23.0
Reviewed-by: Igor Opaniuk igor.opaniuk@gmail.com

On Fri, Sep 20, 2019 at 10:21:29AM -0400, Tom Rini wrote: [..]
Reviewed-by: Tom Rini trini@konsulko.com
On Tue, Sep 24, 2019 at 09:24:57AM +0300, Igor Opaniuk wrote: [..]
Reviewed-by: Igor Opaniuk igor.opaniuk@gmail.com
Thank you for the swift reviews!

On Fri, Sep 20, 2019 at 03:59:18PM +0200, Eugeniu Rosca wrote:
From: Roman Stratiienko roman.stratiienko@globallogic.com
At this point we are using part number sub-command to retrieve UUID of the partition using it's name.
e.g.: part number mmc $mmcdev system_a system_a_index part uuid mmc $mmcdev:${system_a_index} system_a_uuid
Since 'part uuid' sub-command expects partition index in hex format and 'part number' returns decimal value, 'part uuid' command will provide wrong UUID or fail.
Fixes: be683756f62034 ("cmd: part: Add 'number' sub-command") Cc: Dirk Behme dirk.behme@de.bosch.com Reported-by: Pontus Fuchs pontus.fuchs@se.bosch.com Signed-off-by: Roman Stratiienko roman.stratiienko@globallogic.com Signed-off-by: Eugeniu Rosca erosca@de.adit-jv.com Reviewed-by: Tom Rini trini@konsulko.com Reviewed-by: Igor Opaniuk igor.opaniuk@gmail.com
Applied to u-boot/master, thanks!
participants (3)
-
Eugeniu Rosca
-
Igor Opaniuk
-
Tom Rini