]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
util/grub-install: Fix NULL pointer dereferences
authorDaniel Kiper <daniel.kiper@oracle.com>
Thu, 25 Feb 2021 17:35:01 +0000 (18:35 +0100)
committerDaniel Kiper <daniel.kiper@oracle.com>
Tue, 2 Mar 2021 14:54:17 +0000 (15:54 +0100)
Two grub_device_open() calls does not have associated NULL checks
for returned values. Fix that and appease the Coverity.

Fixes: CID 314583
Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
util/grub-install.c

index 79fc4b93720bd7714ce6a4a92a7fb21efff82436..a0babe3eff9609cfe7b5c5950edf916efac8a066 100644 (file)
@@ -1784,6 +1784,8 @@ main (int argc, char *argv[])
          fill_core_services (core_services);
 
          ins_dev = grub_device_open (install_drive);
+         if (ins_dev == NULL)
+           grub_util_error ("%s", grub_errmsg);
 
          bless (ins_dev, core_services, 0);
 
@@ -1884,6 +1886,8 @@ main (int argc, char *argv[])
          fill_core_services(core_services);
 
          ins_dev = grub_device_open (install_drive);
+         if (ins_dev == NULL)
+           grub_util_error ("%s", grub_errmsg);
 
          bless (ins_dev, boot_efi, 1);
          if (!removable && update_nvram)