From: Alexey Gladkov <legion@kernel.org>
To: Yutao Zhang <tommyzhang4707@outlook.com>
Cc: kbd@lists.linux.dev
Subject: Re: [PATCH] setfont: Initialize data pointer when resetting font
Date: Sun, 7 Dec 2025 18:13:29 +0100 [thread overview]
Message-ID: <aTW1uVLv3_ytLTL7@example.org> (raw)
In-Reply-To: <MEAPR01MB2567EC35DAEE4593965F884CC0A7A@MEAPR01MB2567.ausprd01.prod.outlook.com>
On Sat, Dec 06, 2025 at 05:18:43AM +1100, Yutao Zhang wrote:
> From: Tommy-Zhang3759 <tommyzhang4707@outlook.com>
>
> When resetting the font to default, the `data` field in the
> `console_font_op` structure must be explicitly set to NULL.
>
> Previously, this field was left uninitialized. The kernel treats a
> non-NULL `data` pointer as a pointer to a font name string. This caused
> the ioctl to fail with -EFAULT (Bad address) because it attempted to
> read from a garbage address.
>
> Signed-off-by: Yutao Zhang <tommyzhang4707@outlook.com>
Applied. Thanks!
> ---
> src/libkfont/kdfontop.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/src/libkfont/kdfontop.c b/src/libkfont/kdfontop.c
> index 8f132ff..4f1f0d2 100644
> --- a/src/libkfont/kdfontop.c
> +++ b/src/libkfont/kdfontop.c
> @@ -46,6 +46,7 @@ kfont_restore_font(struct kfont_context *ctx, int fd)
> return -1;
>
> cfo.op = KD_FONT_OP_SET_DEFAULT;
> + cfo.data = NULL;
>
> if (ioctl(fd, KDFONTOP, &cfo)) {
> KFONT_ERR(ctx, "ioctl(KD_FONT_OP_SET_DEFAULT): %m");
> --
> 2.52.0
>
>
--
Rgrds, legion
prev parent reply other threads:[~2025-12-07 17:13 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-05 18:18 [PATCH] setfont: Initialize data pointer when resetting font Yutao Zhang
2025-12-07 17:13 ` Alexey Gladkov [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=aTW1uVLv3_ytLTL7@example.org \
--to=legion@kernel.org \
--cc=kbd@lists.linux.dev \
--cc=tommyzhang4707@outlook.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox