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.ki...@oracle.com>
Reviewed-by: Javier Martinez Canillas <javi...@redhat.com>
---
 util/grub-install.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/util/grub-install.c b/util/grub-install.c
index 79fc4b937..a0babe3ef 100644
--- a/util/grub-install.c
+++ b/util/grub-install.c
@@ -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)
-- 
2.11.0


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to