From: Alexey Gladkov <legion@kernel.org>
To: Areg Krdyan <areg.krdian@gmail.com>
Cc: kbd@lists.linux.dev
Subject: Re: [PATCH 4/4] libkeymap: add NULL check in lk_dump_ctable diacritical loop
Date: Sun, 15 Feb 2026 18:49:06 +0100 [thread overview]
Message-ID: <aZIHEvpTfmVgvQTl@example.org> (raw)
In-Reply-To: <CAMj1D1VLW_0tn_3=HT7--W53K67vKv21+hMqQWFz6vK8wd1Npw@mail.gmail.com>
On Sun, Feb 15, 2026 at 11:04:05AM +0300, Areg Krdyan wrote:
> Thanks for the reply! All the changes that I made were done by myself.
>
> I am currently undergoing an internship at Redsoft and my task is to
> check the output of the static analyzer for kbd. I also wanted to fix
> these static analyzer calls, some of them have already been fixed. Not
> all of them are real errors, but they can help to detect the error
> when changing the code.
That's good, but the desire to satisfy the static analyzer should not be
the only reason for making changes. Especially if the analyzer clearly
does not fully understand the code.
> Such checks are already in the project. Eg:
> for (t = 0; t < MAX_NR_KEYMAPS; t++) { // libkeymap/kernel.c:24
> if (t > UCHAR_MAX) {
> ERR(ctx, _("table %d must be less than %d"), t, UCHAR_MAX);
> return -1;
> }
> .....
> }
> With these constants, the error will never be triggered, since
> MAX_NR_KEYMAPS = 256 and UCHAR_MAX = 255. But in the future, when
> changing MAX_NR_KEYMAPS, it will be useful to have a check to detect
> an error.
The check for UCHAR_MAX here is not because of MAX_NR_KEYMAPS, but because
KDGKBENT/KDSKBENT use struct kbentry, which defines kb_table as unsigned
char. This cannot be changed because it is part of the Linux kernel API.
>
> Please let me know if patches of this kind are not needed.
> Thanks again for your time.
>
--
Rgrds, legion
next prev parent reply other threads:[~2026-02-15 17:49 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-14 17:27 [PATCH 1/4] libkeymap: prevent NULL dereference in parser Krdyan Areg
2026-02-14 17:27 ` [PATCH 2/4] kbdfile: remove redundant NULL check in findfile_by_fullname Krdyan Areg
2026-02-14 17:27 ` [PATCH 3/4] libkeymap: add NULL check in kt_latin symbol lookup Krdyan Areg
2026-02-14 17:27 ` [PATCH 4/4] libkeymap: add NULL check in lk_dump_ctable diacritical loop Krdyan Areg
2026-02-14 23:08 ` Alexey Gladkov
2026-02-15 8:04 ` Areg Krdyan
2026-02-15 17:49 ` Alexey Gladkov [this message]
2026-02-15 17:34 ` [PATCH 1/4] libkeymap: prevent NULL dereference in parser Alexey Gladkov
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=aZIHEvpTfmVgvQTl@example.org \
--to=legion@kernel.org \
--cc=areg.krdian@gmail.com \
--cc=kbd@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox