Blame SOURCES/0408-zfsinfo-Correct-a-check-for-error-allocating-memory.patch

468bd4
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
468bd4
From: Darren Kenny <darren.kenny@oracle.com>
468bd4
Date: Thu, 26 Nov 2020 10:56:45 +0000
468bd4
Subject: [PATCH] zfsinfo: Correct a check for error allocating memory
468bd4
468bd4
While arguably the check for grub_errno is correct, we should really be
468bd4
checking the return value from the function since it is always possible
468bd4
that grub_errno was set elsewhere, making this code behave incorrectly.
468bd4
468bd4
Fixes: CID 73668
468bd4
468bd4
Signed-off-by: Darren Kenny <darren.kenny@oracle.com>
468bd4
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
468bd4
---
468bd4
 grub-core/fs/zfs/zfsinfo.c | 4 ++--
468bd4
 1 file changed, 2 insertions(+), 2 deletions(-)
468bd4
468bd4
diff --git a/grub-core/fs/zfs/zfsinfo.c b/grub-core/fs/zfs/zfsinfo.c
030dc3
index c8a28acf52b..bf2918018e7 100644
468bd4
--- a/grub-core/fs/zfs/zfsinfo.c
468bd4
+++ b/grub-core/fs/zfs/zfsinfo.c
468bd4
@@ -358,8 +358,8 @@ grub_cmd_zfs_bootfs (grub_command_t cmd __attribute__ ((unused)), int argc,
468bd4
     return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("one argument expected"));
468bd4
 
468bd4
   devname = grub_file_get_device_name (args[0]);
468bd4
-  if (grub_errno)
468bd4
-    return grub_errno;
468bd4
+  if (devname == NULL)
468bd4
+    return GRUB_ERR_OUT_OF_MEMORY;
468bd4
 
468bd4
   dev = grub_device_open (devname);
468bd4
   grub_free (devname);