summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToomas Soome <tsoome@me.com>2020-09-02 12:48:02 +0300
committerToomas Soome <tsoome@me.com>2020-09-12 00:13:30 +0300
commit92db730eedd4fcf11958d5b89b6d63f99488d594 (patch)
treead70e682685ed7da9f13ff65eeab7abae90b1171
parentd96925c4917df4be0de8533ddaa487c9d915b8c5 (diff)
downloadillumos-joyent-92db730eedd4fcf11958d5b89b6d63f99488d594.tar.gz
13117 zfs: variable dereferenced before check
Reviewed by: Andrew Stormont <andyjstormont@gmail.com> Reviewed by: C Fraire <cfraire@me.com> Reviewed by: Patrick Mooney <pmooney@pfmooney.com> Approved by: Robert Mustacchi <rm@fingolfin.org>
-rw-r--r--usr/src/uts/common/fs/zfs/zvol.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/usr/src/uts/common/fs/zfs/zvol.c b/usr/src/uts/common/fs/zfs/zvol.c
index 02eb0b8e1a..55dd9a2681 100644
--- a/usr/src/uts/common/fs/zfs/zvol.c
+++ b/usr/src/uts/common/fs/zfs/zvol.c
@@ -1155,10 +1155,10 @@ zvol_dumpio(zvol_state_t *zv, void *addr, uint64_t offset, uint64_t size,
ASSERT(size <= zv->zv_volblocksize);
/* Locate the extent this belongs to */
- ze = list_head(&zv->zv_extents);
- while (offset >= ze->ze_nblks * zv->zv_volblocksize) {
+ for (ze = list_head(&zv->zv_extents);
+ ze != NULL && offset >= ze->ze_nblks * zv->zv_volblocksize;
+ ze = list_next(&zv->zv_extents, ze)) {
offset -= ze->ze_nblks * zv->zv_volblocksize;
- ze = list_next(&zv->zv_extents, ze);
}
if (ze == NULL)