When a target device is 0 bytes long, there's no point in exposing it to
the user. Let's just skip them.
Also, when an offset is passed into the efi disk creation, we should
remove this offset from the total number of sectors we can handle.
This patch fixes both things.
Signed-off-by: Alexander Graf <agraf@suse.de>
struct efi_device_path_file_path *dp;
int objlen = sizeof(*diskobj) + (sizeof(*dp) * 2);
+ /* Don't add empty devices */
+ if (!desc->lba)
+ return;
+
diskobj = calloc(1, objlen);
/* Fill in object data */
diskobj->media.media_present = 1;
diskobj->media.block_size = desc->blksz;
diskobj->media.io_align = desc->blksz;
- diskobj->media.last_block = desc->lba;
+ diskobj->media.last_block = desc->lba - offset;
diskobj->ops.media = &diskobj->media;
/* Fill in device path */