浏览代码

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

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.

Reported-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
Signed-off-by: Tom Rini <trini@ti.com>
Stephen Warren 12 年之前
父节点
当前提交
6ab6a650a4
共有 1 个文件被更改,包括 2 次插入0 次删除
  1. 2 0
      disk/part.c

+ 2 - 0
disk/part.c

@@ -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