Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
emulab
emulab-grub2
Commits
475bffea
Commit
475bffea
authored
Jan 20, 2015
by
Vladimir Serbinenko
Browse files
* grub-core/fs/zfs.c: Avoid divisions by zero.
parent
9deb46e3
Changes
2
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
475bffea
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.
grub-core/fs/zfs/zfs.c
View file @
475bffea
...
...
@@ -1501,6 +1501,9 @@ read_device (grub_uint64_t offset, struct grub_zfs_device_desc *desc,
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
;
...
...
@@ -2804,6 +2807,9 @@ dnode_get_path (struct subvolume *subvol, const char *path_in, dnode_end_t *dn,
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
;
...
...
@@ -3798,6 +3804,12 @@ grub_zfs_read (grub_file_t file, char *buf, grub_size_t len)
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
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment