Function grub_efi_find_last_device_path() may return NULL when called
from grub_efidisk_get_device_name().
Signed-off-by: Eric Snowberg <eric.snowberg@oracle.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
Function grub_efi_find_last_device() path may return NULL when called
from is_child().
Signed-off-by: Eric Snowberg <eric.snowberg@oracle.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
Function grub_efi_find_last_device_path() may return constant NULL when
called from find_parent_device().
Signed-off-by: Eric Snowberg <eric.snowberg@oracle.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
In util/getroot and efidisk slightly modify exitsing comment to mostly
retain it but still make GCC7 compliant with respect to fall through
annotation.
In grub-core/lib/xzembed/xz_dec_lzma2.c it adds same comments as
upstream.
In grub-core/tests/setjmp_tets.c declare functions as "noreturn" to
suppress GCC7 warning.
In grub-core/gnulib/regexec.c use new __attribute__, because existing
annotation is not recognized by GCC7 parser (which requires that comment
immediately precedes case statement).
Otherwise add FALLTHROUGH comment.
Closes: 50598
iPXE adds Simple File System Protocol to loaded image handle, as side
effect it also adds Block IO protocol (according to comments, to work
around some bugs in EDK2). GRUB assumes that every device with Block IO
is disk and skips network initialization entirely. But iPXE Block IO
implementation is just a stub which always fails for every operation
so cannot be used. Attempt to detect and skip such devices.
We are using media ID which iPXE sets to "iPXE" and block IO size in
hope that no real device would announce 1B block ...
Closes: 50518
Returned from the OpenProtocol operation, the grub_efi_block_io_media
structure contains the io_align field, specifying the minimum alignment
required for buffers used in any data transfers with the device.
Make grub_efidisk_readwrite() allocate a temporary buffer, aligned to
this boundary, if the buffer passed to it does not already meet the
requirements.
Also sanity check the io_align field in grub_efidisk_open() for
power-of-two-ness and bail if invalid.
Map EFI_NO_MEDIA to GRUB_ERR_OUT_OF_RANGE that is ignored by diskfilter. This
actually matches pretty close (we obviously attempt to read outside of media)
and avoids adding more error codes.
This affects only internally initiated scans. If read/write from removable is
explicitly requested, we still return an error and text explanation is more
clear for user than generic error.
Reported and tested by Andreas Loew <Andreas.Loew@gmx.net>
incorrect devices.
* grub-core/disk/efi/efidisk.c (get_diskname_from_path_real): New
function.
(get_diskname_from_path): Likewise.
(grub_efidisk_get_device_name): Use get_diskname_from_path instead
of iterating.
* Makefile.util.def (libgrub.a): Add grub-core/partmap/bsdlabel.c.
* grub-core/disk/efi/efidisk.c (grub_efidisk_get_device_name):
Properly handle concatenation.
* grub-core/kern/device.c (grub_device_iterate): Likewise.
* grub-core/normal/completion.c (iterate_partition): Likewise.
* grub-core/kern/disk.c (grub_disk_open): Make disk->name not
contain partition. All users updated.
* grub-core/partmap/bsdlabel.c (grub_netbsdlabel_partition_map): New
struct.
(grub_openbsdlabel_partition_map): Likewise.
(bsdlabel_partition_map_iterate): Rename to ..
(iterate_real): ... this. New arguments sector, freebsd and pmap.
(bsdlabel_partition_map_iterate): New function.
(netopenbsdlabel_partition_map_iterate): Likewise.
(netbsdlabel_partition_map_iterate): Likewise.
(openbsdlabel_partition_map_iterate): Likewise.
(GRUB_MOD_INIT): Register new partmaps.
(GRUB_MOD_FINI): Unregister new partmaps.
* grub-core/partmap/msdos.c (pc_partition_map_iterate): Rename to ...
(grub_partition_msdos_iterate): ... this. All users updated.
Don't support embedding other than in a minix partition.
* include/grub/msdos_partition.h (grub_partition_msdos_iterate): New
proto.
* include/grub/partition.h (grub_partition): New field msdostype.
* util/grub-install.in: Handle openbsd and netbsd types being in
part_bsd module.
All users updated.
* disk/loopback.c (grub_loopback): Remove has_partitions.
All users updated.
(options): Remove partitions. All users updated.
* util/grub-fstest.c (fstest): Don't pass "-p" to loopback.
* util/i386/pc/grub-setup.c (setup): copy partition table only when
actual partition table is found.