]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
Revert "zfsinfo: Correct a check for error allocating memory"
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Fri, 6 Oct 2023 18:23:53 +0000 (20:23 +0200)
committerDaniel Kiper <daniel.kiper@oracle.com>
Thu, 12 Oct 2023 17:28:33 +0000 (19:28 +0200)
Original commit is wrong because grub_file_get_device_name() may return NULL
if we use implicit $root. Additionally, the grub_errno is guaranteed to be
GRUB_ERR_NONE at the beginning of a command. So, everything should work as
expected and Coverity report, CID 73668, WRT to this code should be treated
as false positive.

This reverts commit 7aab03418 (zfsinfo: Correct a check for error allocating memory).

Fixes: 7aab03418 (zfsinfo: Correct a check for error allocating memory)
Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
grub-core/fs/zfs/zfsinfo.c

index bf2918018e7667065347aab549e455cf09b73b35..c8a28acf52b89d152c1d91f30826be740d8e8aea 100644 (file)
@@ -358,8 +358,8 @@ grub_cmd_zfs_bootfs (grub_command_t cmd __attribute__ ((unused)), int argc,
     return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("one argument expected"));
 
   devname = grub_file_get_device_name (args[0]);
-  if (devname == NULL)
-    return GRUB_ERR_OUT_OF_MEMORY;
+  if (grub_errno)
+    return grub_errno;
 
   dev = grub_device_open (devname);
   grub_free (devname);