All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Praneeth Balasubramanian" <praneethb2002@gmail.com>
Cc: linux-serial@vger.kernel.org
Subject: Re: [PATCH v2] powerpc/pseries/hvconsole: Do not read past count in hvc_put_chars()
Date: Sat, 05 Dec 2026 08:46:34 +0000	[thread overview]
Message-ID: <sashiko-outbox-251295@kernel.org> (raw)
In-Reply-To: <20261205083025.2602522-1-praneethb2002@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] tty: hvc: obsolete bounce_buffer and stale comment in
  udbg_hvc_putc()
--

commit 290462d6849c20919495b48c771bea34f3357693
Author: Praneeth Balasubramanian <praneethb2002@gmail.com>

powerpc/pseries/hvconsole: Do not read past count in hvc_put_chars()

This commit copies count bytes into a zeroed local buffer in
hvc_put_chars() before issuing the H_PUT_TERM_CHAR hcall, and drops the
16-byte buffer size requirement from the comments on hvc_put_chars() and
hvterm_raw_put_chars().

> diff --git a/drivers/tty/hvc/hvc_vio.c b/drivers/tty/hvc/hvc_vio.c
> index 14c6a55646176..f385978baa9ec 100644
> --- a/drivers/tty/hvc/hvc_vio.c
> +++ b/drivers/tty/hvc/hvc_vio.c
> @@ -110,9 +110,7 @@ static ssize_t hvterm_raw_get_chars(uint32_t vtermno, u8 *buf, size_t count)
>  /**
>   * hvterm_raw_put_chars: send characters to firmware for given vterm adapter
>   * @vtermno: The virtual terminal number.
> - * @buf: The characters to send. Because of the underlying hypercall in
> - *       hvc_put_chars(), this buffer must be at least 16 bytes long, even if
> - *       you are sending fewer chars.
> + * @buf: The characters to send.
>   * @count: number of chars to send.
>   */
>  static ssize_t hvterm_raw_put_chars(uint32_t vtermno, const u8 *buf,

[Severity: Low]
Can bounce_buffer in udbg_hvc_putc() in this same file also be dropped?

Now that hvc_put_chars() handles short buffers and the 16-byte
requirement is removed here, the workaround added by commit 934bda59f286
("powerpc/pseries/hvconsole: Fix stack overread via udbg") leaves an
unnecessary 16-byte stack buffer and a stale comment in udbg_hvc_putc():

drivers/tty/hvc/hvc_vio.c:udbg_hvc_putc() {
	...
		case HV_PROTOCOL_RAW:
			/*
			 * hvterm_raw_put_chars requires at least a 16-byte
			 * buffer, so go via the bounce buffer
			 */
			bounce_buffer[0] = c;
			count = hvterm_raw_put_chars(0, bounce_buffer, 1);
			break;
	...
}

Replacing that with hvterm_raw_put_chars(0, &c, 1), matching the
HV_PROTOCOL_HVSI case below it, removes the contradictory comment and
redundant stack buffer.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261205083025.2602522-1-praneethb2002@gmail.com?part=1

      reply	other threads:[~2026-12-05  8:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-05  8:30 [PATCH v2] powerpc/pseries/hvconsole: Do not read past count in hvc_put_chars() Praneeth Balasubramanian
2026-12-05  8:46 ` sashiko-bot [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-251295@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=praneethb2002@gmail.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.