]> www.infradead.org Git - users/hch/xfsprogs.git/commitdiff
xfs_scrub: don't allow zero or negative error injection interval
authorDarrick J. Wong <darrick.wong@oracle.com>
Fri, 1 Nov 2019 19:48:48 +0000 (15:48 -0400)
committerEric Sandeen <sandeen@sandeen.net>
Fri, 1 Nov 2019 19:48:48 +0000 (15:48 -0400)
Don't allow zero or negative values from XFS_SCRUB_DISK_ERROR_INTERVAL
to slip into the system.  This is a debugging knob so we don't need to
be rigorous, but we can at least take care of obvious garbage values.

Coverity-id: 1454842
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
[sandeen: fix patch title]
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
scrub/disk.c

index 214a534601ca6d1721f2342326c8db73fd09b2aa..8a8a411b335d006dd7f98329caf0387800655ae3 100644 (file)
@@ -303,6 +303,10 @@ disk_simulate_read_error(
                interval = strtoull(p, NULL, 10);
                interval &= ~((1U << disk->d_lbalog) - 1);
        }
+       if (interval <= 0) {
+               interval = -1;
+               return 0;
+       }
 
        /*
         * We simulate disk errors by pretending that there are media errors at