From: Karel Zak Date: Mon, 16 Feb 2026 09:04:43 +0000 (+0100) Subject: dmesg: improve buffer size error message X-Git-Tag: v2.43-devel~93 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=aa2e0f145a7178aa88f6beb09c1ded588bcbfe73;p=thirdparty%2Futil-linux.git dmesg: improve buffer size error message Improve the error message when buffer size is too large to include the maximum allowed size. This helps users understand what the actual limit is rather than just reporting an invalid value. Before: invalid buffer size argument: '...' After: buffer size ... is too large (maximum is ...) Signed-off-by: Karel Zak --- diff --git a/sys-utils/dmesg.c b/sys-utils/dmesg.c index a0786da2b..4a7357d9f 100644 --- a/sys-utils/dmesg.c +++ b/sys-utils/dmesg.c @@ -1788,8 +1788,9 @@ int main(int argc, char *argv[]) if (ctl.bufsize < 4096) ctl.bufsize = 4096; if (ctl.bufsize > SIZE_MAX - 8) - errx(EXIT_FAILURE, "%s: '%s'", - _("invalid buffer size argument"), optarg); + errx(EXIT_FAILURE, + _("buffer size %s is too large (maximum is %zu)"), + optarg, SIZE_MAX - 8); break; case 'T': include_time_fmt(&ctl, DMESG_TIMEFTM_CTIME);