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
This commit is contained in:
parent
54ca36aeac
commit
e9b29d1604
@ -310,23 +310,22 @@ nandfs_cleaner_choose_segment(struct nandfs_device *fsdev, uint64_t **segpp,
|
||||
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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user