From b4ba8e025bcc3b944deddce7b43b31cffb6a6fa1 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sun, 12 Feb 2012 19:19:57 +0100 Subject: [PATCH] * grub-core/fs/zfs/zfs.c (zfs_fetch_nvlist): Mark unknown member here as GRUB_ERR_BUG. Don't malloc if no device is available. --- ChangeLog | 5 +++++ grub-core/fs/zfs/zfs.c | 7 +++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8563c418f..7fbc46937 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2012-02-12 Vladimir Serbinenko + + * grub-core/fs/zfs/zfs.c (zfs_fetch_nvlist): Mark unknown member here + as GRUB_ERR_BUG. Don't malloc if no device is available. + 2012-02-12 Vladimir Serbinenko * grub-core/term/terminfo.c (grub_terminfo_output_unregister): diff --git a/grub-core/fs/zfs/zfs.c b/grub-core/fs/zfs/zfs.c index 8c1e9ae87..20f425d63 100644 --- a/grub-core/fs/zfs/zfs.c +++ b/grub-core/fs/zfs/zfs.c @@ -571,9 +571,12 @@ zfs_fetch_nvlist (struct grub_zfs_device_desc *diskdesc, char **nvlist) { grub_err_t err; - *nvlist = grub_malloc (VDEV_PHYS_SIZE); + *nvlist = 0; + if (!diskdesc->dev) - return grub_error (GRUB_ERR_BAD_FS, "member drive unknown"); + return grub_error (GRUB_ERR_BUG, "member drive unknown"); + + *nvlist = grub_malloc (VDEV_PHYS_SIZE); /* Read in the vdev name-value pair list (112K). */ err = grub_disk_read (diskdesc->dev->disk, diskdesc->vdev_phys_sector, 0,