From nobody Fri Nov 29 21:39:29 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Y0RQn5gx9z5flBG; Fri, 29 Nov 2024 21:39:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Y0RQn3kWGz44Mp; Fri, 29 Nov 2024 21:39:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1732916369; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=/eNZQ+bt4I6UCn6XmEgNxxYOZH35ik4I6MmeIB2gyJM=; b=xO9mWG+jzQtGAMhmzBjLoBjVOeXiFfKhYb6sKEscRV8nFK/I8Q+uNcN5Wkx4iI46T/UFiR yFGDzlYBoHPG1tVXOb7jI9MQkH5O5LFyFL6ZsvPknvdKONo7qyglcLEPjlF+f34SA6gL9f DsF3O16984wGBWBcnu07pUHcVLgTnVBOszzi7TJ72EtxqUjgZObkmfamUGpaag/izfbnCK H/d/F/NC/nRk0VeZx131d9Vyh+QZSh5Aql5V2/j+kFAcKKnEKGLjva+eait/SH8a6sHzWU NY7N1uXDhJLNLLMmveaAc7RF+HcvVAhpVwdPMMrxatmMfM15HVOGOzywnARO5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1732916369; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=/eNZQ+bt4I6UCn6XmEgNxxYOZH35ik4I6MmeIB2gyJM=; b=dCMKZNd9wKyJ3/7R7VI4D0orRUfa27xazg7hxTYhdY3kapH148l170KCmFPz8bzToiUCVE eXNU5P1klSrgDBNginKk8KcJi6+WLv7TyOz4LwFqUucqgrEwYmxGSoy/G5bpmmW4xdi5cj waGgXjOY/cJ1AWzItoIR1gnugEwTo5SuAeH+kWDEio0bkVRGQTlPhxsCgPOhnBorD+ZbdO ijQCTPKpw5OBqUiJO7Nl3rXLtnvFBUYy/E5rjUxePSDxAP129e5uhYEOP3oNcwC5Oyz7aM Vc7VWJOB+fH6Qd/wZrVwEftk9v3R+bb137Qtjdohx9hGIomIP59sQpRq/iMkyw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1732916369; a=rsa-sha256; cv=none; b=YS+5S89jgyQjZPdPP0k+95nlsADzEXKUWe1zgcCQcJHnCVME7uyVafIMb/p3LEk0jKsFwk 5Y/kf5XFokfEAAZ1DlIi6rG2Zkq1brBPOcEyGaTSEdsgSKSJkvTv3oV7gKTJK5Zutyypx4 bagEo6jaWO/O6ew/yhC+USTi8H5HDTct19sJYh+nyQOSzUVZtMmHGou9Et0i7egxdj/ZV7 oh3vIdMzES1O+nKy8/yxKLk8CZGUBsQDWU1PCXJBfCtY9Bcd6I7x75ubhExHuqB77ycDJI v5XzZIbf30IdXl8r9EsE7qsmFfESWdmmwZovqfGD561mBAuPpAW51JFuk5LXpw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Y0RQn3LLHzg1R; Fri, 29 Nov 2024 21:39:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4ATLdTIp094153; Fri, 29 Nov 2024 21:39:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4ATLdToN094150; Fri, 29 Nov 2024 21:39:29 GMT (envelope-from git) Date: Fri, 29 Nov 2024 21:39:29 GMT Message-Id: <202411292139.4ATLdToN094150@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: d4f9e326393e - main - libc/stdio: Increase BUF in vfprintf.c and vfwprintf.c List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d4f9e326393e3298062a58338e2c94ef6baff8b5 Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=d4f9e326393e3298062a58338e2c94ef6baff8b5 commit d4f9e326393e3298062a58338e2c94ef6baff8b5 Author: Ahmad Khalifa AuthorDate: 2024-08-31 03:42:04 +0000 Commit: Warner Losh CommitDate: 2024-11-29 21:38:36 +0000 libc/stdio: Increase BUF in vfprintf.c and vfwprintf.c With the %b format specifier we need enough space to write a uintmax_t in binary. Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1400 --- lib/libc/stdio/vfprintf.c | 8 ++------ lib/libc/stdio/vfwprintf.c | 8 ++------ sys/kern/subr_prf.c | 2 +- 3 files changed, 5 insertions(+), 13 deletions(-) diff --git a/lib/libc/stdio/vfprintf.c b/lib/libc/stdio/vfprintf.c index 785340ab2a24..2dc8d9022179 100644 --- a/lib/libc/stdio/vfprintf.c +++ b/lib/libc/stdio/vfprintf.c @@ -291,13 +291,9 @@ vfprintf(FILE * __restrict fp, const char * __restrict fmt0, va_list ap) /* * The size of the buffer we use as scratch space for integer * conversions, among other things. We need enough space to - * write a uintmax_t in octal (plus one byte). + * write a uintmax_t in binary. */ -#if UINTMAX_MAX <= UINT64_MAX -#define BUF 32 -#else -#error "BUF must be large enough to format a uintmax_t" -#endif +#define BUF (sizeof(uintmax_t) * CHAR_BIT) /* * Non-MT-safe version diff --git a/lib/libc/stdio/vfwprintf.c b/lib/libc/stdio/vfwprintf.c index d43b472f7730..0d77bd74567e 100644 --- a/lib/libc/stdio/vfwprintf.c +++ b/lib/libc/stdio/vfwprintf.c @@ -369,13 +369,9 @@ vfwprintf(FILE * __restrict fp, const wchar_t * __restrict fmt0, va_list ap) /* * The size of the buffer we use as scratch space for integer * conversions, among other things. We need enough space to - * write a uintmax_t in octal (plus one byte). + * write a uintmax_t in binary. */ -#if UINTMAX_MAX <= UINT64_MAX -#define BUF 32 -#else -#error "BUF must be large enough to format a uintmax_t" -#endif +#define BUF (sizeof(uintmax_t) * CHAR_BIT) /* * Non-MT-safe version diff --git a/sys/kern/subr_prf.c b/sys/kern/subr_prf.c index 5cfc92e9761a..131d5456d2f9 100644 --- a/sys/kern/subr_prf.c +++ b/sys/kern/subr_prf.c @@ -512,7 +512,7 @@ putchar(int c, void *arg) if ((flags & TOTTY) && tp != NULL && !KERNEL_PANICKED()) tty_putchar(tp, c); - if ((flags & TOCONS ) && cn_mute) { + if ((flags & TOCONS) && cn_mute) { flags &= ~TOCONS; ap->flags = flags; }