Skip to content

Commit 8dd63aa

Browse files
committed
btrfs-progs: fix conditions order when parsing scrub status line
As reported (cppcheck), the conditions are reversed as we first need to check the limit and only then access the data. Issue: #1030 Signed-off-by: David Sterba <[email protected]>
1 parent 2115abe commit 8dd63aa

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

cmds/scrub.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,7 @@ static struct scrub_file_record **scrub_read_file(int fd, int report_errors)
663663
++state;
664664
fallthrough;
665665
case 2: /* start of line, skip space */
666-
while (isspace(l[i]) && i < avail) {
666+
while (i < avail && isspace(l[i])) {
667667
if (l[i] == '\n')
668668
++lineno;
669669
++i;

0 commit comments

Comments
 (0)