]> git.proxmox.com Git - zfs-grub.git/blame - pvepatches/zfs-Fix-error-handling.patch
use latest packages from githup (2.02-beta2.9-ZOL11-7aa9f6)
[zfs-grub.git] / pvepatches / zfs-Fix-error-handling.patch
CommitLineData
0a671b56
DM
1From 0daf46fdbd37627411f3a0dd99390ee4523de1bb Mon Sep 17 00:00:00 2001
2From: Vladimir Serbinenko <phcoder@gmail.com>
3Date: Tue, 27 Jan 2015 15:31:35 +0000
4Subject: fs/zfs: Fix error handling.
5
6Found by: Coverity Scan.
7---
8(limited to 'grub-core/fs/zfs')
9
10diff --git a/grub-core/fs/zfs/zfs.c b/grub-core/fs/zfs/zfs.c
11index c8c7b97..9edac50 100644
12--- a/grub-core/fs/zfs/zfs.c
13+++ b/grub-core/fs/zfs/zfs.c
14@@ -285,7 +285,7 @@ static const char *spa_feature_names[] = {
15
16 static int
17 check_feature(const char *name, grub_uint64_t val, struct grub_zfs_dir_ctx *ctx);
18-static int
19+static grub_err_t
20 check_mos_features(dnode_phys_t *mosmdn_phys,grub_zfs_endian_t endian,struct grub_zfs_data* data );
21
22 static grub_err_t
23@@ -1975,7 +1975,7 @@ dmu_read (dnode_end_t * dn, grub_uint64_t blkid, void **buf,
24 dn->endian)
25 << SPA_MINBLOCKSHIFT;
26 *buf = grub_malloc (size);
27- if (*buf)
28+ if (!*buf)
29 {
30 err = grub_errno;
31 break;
32@@ -3979,7 +3979,12 @@ iterate_zap (const char *name, grub_uint64_t val, struct grub_zfs_dir_ctx *ctx)
33 dnode_end_t dn;
34 grub_memset (&info, 0, sizeof (info));
35
36- dnode_get (&(ctx->data->subvol.mdn), val, 0, &dn, ctx->data);
37+ err = dnode_get (&(ctx->data->subvol.mdn), val, 0, &dn, ctx->data);
38+ if (err)
39+ {
40+ grub_print_error ();
41+ return 0;
42+ }
43
44 if (dn.dn.dn_bonustype == DMU_OT_SA)
45 {
46@@ -4200,11 +4205,11 @@ check_feature (const char *name, grub_uint64_t val,
47 * errnum: Failure.
48 */
49
50-static int
51+static grub_err_t
52 check_mos_features(dnode_phys_t *mosmdn_phys,grub_zfs_endian_t endian,struct grub_zfs_data* data )
53 {
54 grub_uint64_t objnum;
55- grub_uint8_t errnum = 0;
56+ grub_err_t errnum = 0;
57 dnode_end_t dn,mosmdn;
58 mzap_phys_t* mzp;
59 grub_zfs_endian_t endianzap;
60--
61cgit v0.9.0.2