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

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