summaryrefslogtreecommitdiffstats
path: root/sys/fs/nandfs
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2012-05-28 16:33:58 +0000
committermarcel <marcel@FreeBSD.org>2012-05-28 16:33:58 +0000
commite9bb2ca35e7586b04c6cd09941850044287ee0de (patch)
tree3f577d352beab53c984727c0e879cd24c64dfbaf /sys/fs/nandfs
parentd94838259507f93af78a52b5f4e40a813a2c376c (diff)
downloadFreeBSD-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.c15
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);
}
OpenPOWER on IntegriCloud