+2015-01-20 Vladimir Serbinenko <phcoder@gmail.com>
+
+ * grub-core/fs/zfs.c: Avoid divisions by zero.
+
2015-01-20 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/fs/btrfs.c: Avoid divisions by zero.
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
"raidz%d is not supported", desc->nparity);
+ if (desc->n_children <= desc->nparity || desc->n_children < 1)
+ return grub_error(GRUB_ERR_BAD_FS, "too little devices for given parity");
+
orig_s = (((len + (1 << desc->ashift) - 1) >> desc->ashift)
+ (desc->n_children - desc->nparity) - 1);
s = orig_s;
dnode_path->dn.endian)
<< SPA_MINBLOCKSHIFT);
+ if (blksz == 0)
+ return grub_error(GRUB_ERR_BAD_FS, "0-sized block");
+
sym_value = grub_malloc (sym_sz);
if (!sym_value)
return grub_errno;
blksz = grub_zfs_to_cpu16 (data->dnode.dn.dn_datablkszsec,
data->dnode.endian) << SPA_MINBLOCKSHIFT;
+ if (blksz == 0)
+ {
+ grub_error (GRUB_ERR_BAD_FS, "0-sized block");
+ return -1;
+ }
+
/*
* Entire Dnode is too big to fit into the space available. We
* will need to read it in chunks. This could be optimized to