grub2/0254-fs-zfs-Fix-error-handling.patch
Peter Jones 8c6b1ac71e Reconcile with upstream once again.
Also include some minor fixes for gcc 5.1.1

Signed-off-by: Peter Jones <pjones@redhat.com>
2015-07-22 09:46:32 -04:00

64 lines
1.8 KiB
Diff

From 0daf46fdbd37627411f3a0dd99390ee4523de1bb Mon Sep 17 00:00:00 2001
From: Vladimir Serbinenko <phcoder@gmail.com>
Date: Tue, 27 Jan 2015 16:31:35 +0100
Subject: [PATCH 254/506] fs/zfs: Fix error handling.
Found by: Coverity Scan.
---
grub-core/fs/zfs/zfs.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/grub-core/fs/zfs/zfs.c b/grub-core/fs/zfs/zfs.c
index c8c7b97..9edac50 100644
--- a/grub-core/fs/zfs/zfs.c
+++ b/grub-core/fs/zfs/zfs.c
@@ -285,7 +285,7 @@ static const char *spa_feature_names[] = {
static int
check_feature(const char *name, grub_uint64_t val, struct grub_zfs_dir_ctx *ctx);
-static int
+static grub_err_t
check_mos_features(dnode_phys_t *mosmdn_phys,grub_zfs_endian_t endian,struct grub_zfs_data* data );
static grub_err_t
@@ -1975,7 +1975,7 @@ dmu_read (dnode_end_t * dn, grub_uint64_t blkid, void **buf,
dn->endian)
<< SPA_MINBLOCKSHIFT;
*buf = grub_malloc (size);
- if (*buf)
+ if (!*buf)
{
err = grub_errno;
break;
@@ -3979,7 +3979,12 @@ iterate_zap (const char *name, grub_uint64_t val, struct grub_zfs_dir_ctx *ctx)
dnode_end_t dn;
grub_memset (&info, 0, sizeof (info));
- dnode_get (&(ctx->data->subvol.mdn), val, 0, &dn, ctx->data);
+ err = dnode_get (&(ctx->data->subvol.mdn), val, 0, &dn, ctx->data);
+ if (err)
+ {
+ grub_print_error ();
+ return 0;
+ }
if (dn.dn.dn_bonustype == DMU_OT_SA)
{
@@ -4200,11 +4205,11 @@ check_feature (const char *name, grub_uint64_t val,
* errnum: Failure.
*/
-static int
+static grub_err_t
check_mos_features(dnode_phys_t *mosmdn_phys,grub_zfs_endian_t endian,struct grub_zfs_data* data )
{
grub_uint64_t objnum;
- grub_uint8_t errnum = 0;
+ grub_err_t errnum = 0;
dnode_end_t dn,mosmdn;
mzap_phys_t* mzp;
grub_zfs_endian_t endianzap;
--
2.4.3