7.3-stable review patch. If anyone has any objections, please let me know. ------------------ From: Darrick J. Wong commit 6b8d60784b61a17bd591cb4c6e8aa9ed29c24f5c upstream. LOLLM complains that xchk_stats_estimate_bufsize underestimates the buffer size by 1 byte because scnprintf wants to store a null byte after the newline in each line. Each call to scnprintf overwrites the null left by the previous call, but we still need the null byte for the last line in the file. Cc: stable@vger.kernel.org # v6.6 Fixes: d7a74cad8f4513 ("xfs: track usage statistics of online fsck") Signed-off-by: Darrick J. Wong Assisted-by: LOLLM # finding obvious bugs Reviewed-by: Christoph Hellwig Signed-off-by: Carlos Maiolino Signed-off-by: Greg Kroah-Hartman --- fs/xfs/scrub/stats.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/fs/xfs/scrub/stats.c +++ b/fs/xfs/scrub/stats.c @@ -168,7 +168,8 @@ xchk_stats_estimate_bufsize( ret += field_width + 1; } - return ret; + /* null byte for scnprintf */ + return ret + 1; } /* Clear all counters. */