From: Darrick J. Wong Date: Fri, 1 Nov 2019 19:48:48 +0000 (-0400) Subject: xfs_scrub: don't allow zero or negative error injection interval X-Git-Tag: v5.3.0-rc2~60 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b8302b7f9b470cf4ab2403f2066b2de8de0dad50;p=thirdparty%2Fxfsprogs-dev.git xfs_scrub: don't allow zero or negative error injection interval 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 Reviewed-by: Eric Sandeen [sandeen: fix patch title] Signed-off-by: Eric Sandeen --- diff --git a/scrub/disk.c b/scrub/disk.c index 214a53460..8a8a411b3 100644 --- a/scrub/disk.c +++ b/scrub/disk.c @@ -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