Skip to contentSkip to conversation

disk: initialize name/part fields when returning a whole disk

PATCH In review Stephen Warren 3 participants 4 messages Oct 10, 2012 – Oct 20, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 disk: initialize name/part fields when returning a whole disk

From: Stephen Warren <[email protected]>

When get_device_and_partition() finds a disk without a partition table, under some conditions, it "returns" a disk_partition_t that describes the entire raw disk. Make sure to initialize all fields in the partition descriptor in that case.

The value chosen for name is just some arbitrary descriptive string.

The value chosen for info matches the check at the end of get_device_and_partition(). However, it's probably not that important; it's not obvious that the value is really used.

---
Tom, this is technically a bug, so putting in the release might make sense, although I doubt it has much practical impact, so deferring it into u-boot/next would probably be just as good.

 disk/part.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
disk/part.c +2 -0
index a0c77dd..8ba3cde 100644
@@ -561,6 +561,8 @@ int get_device_and_partition(const char *ifname, const char *dev_part_str,
 		info->size = (*dev_desc)->lba;
 		info->blksz = (*dev_desc)->blksz;
 		info->bootable = 0;
+		strcpy((char *)info->type, BOOT_PART_TYPE);
+		strcpy((char *)info->name, "Whole Disk");
 #ifdef CONFIG_PARTITION_UUIDS
 		info->uuid[0] = 0;
 #endif
Signature · 1 line
1.7.0.4
#1 lore raw

PATCH 1/1 disk: initialize name/part fields when returning a whole disk

Quoted 37 lines · Stephen Warren

When get_device_and_partition() finds a disk without a partition table,
under some conditions, it "returns" a disk_partition_t that describes the entire raw disk. Make sure to initialize all fields in the partition
descriptor in that case.

The value chosen for name is just some arbitrary descriptive string.

The value chosen for info matches the check at the end of get_device_and_partition(). However, it's probably not that important;
it's not obvious that the value is really used.

---
Tom, this is technically a bug, so putting in the release might make sense, although I doubt it has much practical impact, so deferring it into u-boot/next would probably be just as good.

 disk/part.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
disk/part.c +2 -0
index a0c77dd..8ba3cde 100644
@@ -561,6 +561,8 @@ int get_device_and_partition(const char *ifname,
 const char *dev_part_str,
 		info->size = (*dev_desc)->lba;
 		info->blksz = (*dev_desc)->blksz;
 		info->bootable = 0;
+		strcpy((char *)info->type, BOOT_PART_TYPE);
+		strcpy((char *)info->name, "Whole Disk");
 #ifdef CONFIG_PARTITION_UUIDS
 		info->uuid[0] = 0;
Quoted 1 line

#endif

Best regards,
Beno?t

#2 lore raw

PATCH 1/1 disk: initialize name/part fields when returning a whole disk

In reply to Stephen Warren
Quoted 7 lines · Stephen Warren

From: Stephen Warren <[email protected]>

When get_device_and_partition() finds a disk without a partition table, under some conditions, it "returns" a disk_partition_t that describes the entire raw disk. Make sure to initialize all fields in the partition descriptor in that case.

Quoted 8 lines

The value chosen for name is just some arbitrary descriptive string.

The value chosen for info matches the check at the end of get_device_and_partition(). However, it's probably not that important; it's not obvious that the value is really used.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20121020/f5ebe269/attachment.pgp>
#3 lore raw
In reply to Stephen Warren
Quoted 9 lines · Stephen Warren

From: Stephen Warren <[email protected]>

When get_device_and_partition() finds a disk without a partition table, under some conditions, it "returns" a disk_partition_t that describes the entire raw disk. Make sure to initialize all fields in the partition descriptor in that case.

The value chosen for name is just some arbitrary descriptive string.

Quoted 7 lines

The value chosen for info matches the check at the end of get_device_and_partition(). However, it's probably not that important; it's not obvious that the value is really used.

Applied to u-boot/master, thanks!

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