Skip to contentSkip to conversation

cmd: part: number: return hexadecimal value

PATCH New Eugeniu Rosca 3 participants 5 messages Sep 20, 2019 – Oct 6, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cmd: part: number: return hexadecimal value

From: Roman Stratiienko <[email protected]>

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 <[email protected]>
---
 cmd/part.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
cmd/part.c +1 -1
index 6cfb67b27959..5e4e45ca6d8b 100644
@@ -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);
Signature · 1 line
2.23.0
#1 lore raw

PATCH 1/1 cmd: part: number: return hexadecimal value

Quoted 13 lines · Eugeniu Rosca

From: Roman Stratiienko <[email protected]>

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.

Quoted 5 lines
Fixes be683756f62034 ("cmd: part: Add 'number' sub-command")
Cc Dirk Behme <[email protected]>
Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190920/ebbbc35b/attachment.sig>
#2 lore raw

PATCH 1/1 cmd: part: number: return hexadecimal value

In reply to Eugeniu Rosca
Quoted 37 lines · Eugeniu Rosca

From: Roman Stratiienko <[email protected]>

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 <[email protected]>
---
 cmd/part.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
cmd/part.c +1 -2
index 6cfb67b27959..5e4e45ca6d8b 100644
@@ -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);
--
Quoted 2 lines

2.23.0

Signature · 8 lines
Best regards - Freundliche Grüsse - Meilleures salutations

Igor Opaniuk

mailto: igor.opaniuk at gmail.com
skype: igor.opanyuk
+380 (93) 836 40 67
http://ua.linkedin.com/in/iopaniuk
#3 lore raw

PATCH 1/1 cmd: part: number: return hexadecimal value

On Fri, Sep 20, 2019 at 10:21:29AM -0400, Tom Rini wrote:
[..]

Quoted 1 line

On Tue, Sep 24, 2019 at 09:24:57AM +0300, Igor Opaniuk wrote:
[..]

Quoted 1 line

Thank you for the swift reviews!

Signature · 2 lines
Best Regards,
Eugeniu
#4 lore raw

PATCH 1/1 cmd: part: number: return hexadecimal value

In reply to Eugeniu Rosca
Quoted 13 lines · Eugeniu Rosca

From: Roman Stratiienko <[email protected]>

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.

Quoted 7 lines
Fixes be683756f62034 ("cmd: part: Add 'number' sub-command")
Cc Dirk Behme <[email protected]>

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20191005/5d673cf6/attachment.sig>