From: Darrick J. Wong Date: Thu, 4 Jun 2026 06:07:43 +0000 (-0700) Subject: xfs_scrub: don't allow NAN as fstrim percentage X-Git-Tag: v7.1.0~54 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=25c97ededd3e71bf33bf0cf31f6694e5e107d0ad;p=xfsprogs-dev.git xfs_scrub: don't allow NAN as fstrim percentage Don't let users pass us -o fstrim_pct=NaN, because strtod will happily return what looks like success but isn't actually a number. Codex found this fun little nit. Cc: linux-xfs@vger.kernel.org # v6.10.0 Fixes: 34bed605490f93 ("xfs_scrub: tune fstrim minlen parameter based on free space histograms") Signed-off-by: "Darrick J. Wong" Reviewed-by: Andrey Albershteyn --- diff --git a/scrub/xfs_scrub.c b/scrub/xfs_scrub.c index 383aa875..9e73dac9 100644 --- a/scrub/xfs_scrub.c +++ b/scrub/xfs_scrub.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -683,7 +684,7 @@ parse_o_opts( errno = 0; dval = strtod(val, &endp); - if (*endp) { + if (*endp || isnan(dval)) { fprintf(stderr, _("-o fstrim_pct must be a floating point number\n")); usage();