diff options
author | Marcel Moolenaar <marcel@FreeBSD.org> | 2012-05-28 16:33:58 +0000 |
---|---|---|
committer | Marcel Moolenaar <marcel@FreeBSD.org> | 2012-05-28 16:33:58 +0000 |
commit | e9b29d160473aab63993faf5ad87eb02476acc79 (patch) | |
tree | 3f577d352beab53c984727c0e879cd24c64dfbaf /sys/fs | |
parent | 54ca36aeac3eb4d4867f722d4b901f01b4feba7a (diff) | |
download | src-e9b29d160473aab63993faf5ad87eb02476acc79.tar.gz src-e9b29d160473aab63993faf5ad87eb02476acc79.zip |
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
Notes
Notes:
svn path=/head/; revision=236188
Diffstat (limited to 'sys/fs')
-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 9257c10c7c55..b3d313563699 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); } |