From: "Alexey V. Vissarionov" <gremlin@altlinux.org>
To: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Cc: "Alexey V. Vissarionov" <gremlin@altlinux.org>,
Alim Akhtar <alim.akhtar@samsung.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jirislaby@kernel.org>,
Thomas Abraham <thomas.abraham@linaro.org>,
Kukjin Kim <kgene.kim@samsung.com>,
linux-arm-kernel@lists.infradead.org,
linux-samsung-soc@vger.kernel.org, linux-serial@vger.kernel.org,
lvc-project@linuxtesting.org
Subject: Re: [PATCH] serial: samsung: fix buffer size for clk_name
Date: Mon, 16 Jan 2023 21:26:11 +0300 [thread overview]
Message-ID: <20230116182611.GA30526@altlinux.org> (raw)
In-Reply-To: <b82b1194-622c-fc65-d831-7731c72264b7@linaro.org>
[-- Attachment #1: Type: text/plain, Size: 1255 bytes --]
On 2023-01-16 17:16:59 +0100, Krzysztof Kozlowski wrote:
>> Although very unlikely, the 'clk_num' value may be as big
>> as 2**32 - 1 (uint32_max),
> How it could be that high? Code has num_clks defined from 1
> to 4 and it is used as strict boundary for the loop so how
> it could end up here with higher value?
That's why I called this "very unlikely". However, nobody can
definitely exclude the possibility of extending this limit in
the future.
> s3c24xx_serial_getsource() also returns value & with mask,
> so up to 4 max.
Possibly, clk_num should be uint8_t then - so the buffer size
could be extended up to only 17 bytes ("clk_uart_baud255\0")
with format specifiers changed to "%u", or 18 bytes for "%d"
(clk_uart_baud-128\0).
> This does not look like real issue but some change to satisfy
> static code analyzers, so I don't think it's correct approach.
Although I agree this is probably only a theoretical issue, it's
always easier to spend several bytes than to prove that we don't
need to.
But, anyway, the final decision is up to you.
--
Alexey V. Vissarionov
gremlin ПРИ altlinux ТЧК org; +vii-cmiii-ccxxix-lxxix-xlii
GPG: 0D92F19E1C0DC36E27F61A29CD17E2B43D879005 @ hkp://keys.gnupg.net
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]
next prev parent reply other threads:[~2023-01-16 18:37 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-16 14:16 [PATCH] serial: samsung: fix buffer size for clk_name Alexey V. Vissarionov
2023-01-16 16:16 ` Krzysztof Kozlowski
2023-01-16 18:26 ` Alexey V. Vissarionov [this message]
2023-01-19 14:52 ` Greg Kroah-Hartman
2023-02-01 2:44 ` [PATCH v2] " Alexey V. Vissarionov
2023-02-01 7:09 ` Krzysztof Kozlowski
2023-02-01 13:06 ` Greg Kroah-Hartman
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=20230116182611.GA30526@altlinux.org \
--to=gremlin@altlinux.org \
--cc=alim.akhtar@samsung.com \
--cc=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=kgene.kim@samsung.com \
--cc=krzysztof.kozlowski@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=lvc-project@linuxtesting.org \
--cc=thomas.abraham@linaro.org \
/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;
as well as URLs for NNTP newsgroup(s).