diff options
author | marcel <marcel@FreeBSD.org> | 2012-05-28 16:33:58 +0000 |
---|---|---|
committer | marcel <marcel@FreeBSD.org> | 2012-05-28 16:33:58 +0000 |
commit | e9bb2ca35e7586b04c6cd09941850044287ee0de (patch) | |
tree | 3f577d352beab53c984727c0e879cd24c64dfbaf /sys/fs/nandfs | |
parent | d94838259507f93af78a52b5f4e40a813a2c376c (diff) | |
download | FreeBSD-src-e9bb2ca35e7586b04c6cd09941850044287ee0de.zip FreeBSD-src-e9bb2ca35e7586b04c6cd09941850044287ee0de.tar.gz |
Catch a corner case where ssegs could be 0 and thus i would be 0 and
we index suinfo out of bounds (i.e. -1).
Approved by: gber
Diffstat (limited to 'sys/fs/nandfs')
-rw-r--r-- | sys/fs/nandfs/nandfs_cleaner.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/sys/fs/nandfs/nandfs_cleaner.c b/sys/fs/nandfs/nandfs_cleaner.c index 9257c10..b3d3135 100644 --- a/sys/fs/nandfs/nandfs_cleaner.c +++ b/sys/fs/nandfs/nandfs_cleaner.c @@ -310,23 +310,22 @@ retry: nandfs_error("%s:%d", __FILE__, __LINE__); goto out; } - if (ssegs == 0 && *rseg != 0) { *rseg = 0; goto retry; } + if (ssegs > 0) { + print_suinfo(suinfo, ssegs); - print_suinfo(suinfo, ssegs); - - for (i = 0; i < ssegs; i++) { - (**segpp) = suinfo[i].nsi_num; - (*segpp)++; + for (i = 0; i < ssegs; i++) { + (**segpp) = suinfo[i].nsi_num; + (*segpp)++; + } + *rseg = suinfo[i - 1].nsi_num + 1; } - *rseg = suinfo[i - 1].nsi_num + 1; out: free(suinfo, M_NANDFSTEMP); - return (error); } |