From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
To: Borislav Petkov <bp@alien8.de>, Rosen Penev <rosenp@gmail.com>
Cc: linux-edac@vger.kernel.org, Tony Luck <tony.luck@intel.com>,
Kees Cook <kees@kernel.org>,
"Gustavo A. R. Silva" <gustavoars@kernel.org>,
open list <linux-kernel@vger.kernel.org>,
open "list:KERNEL" HARDENING "(not" covered by other
"areas):Keyword:b__counted_by(_le|_be)?b"
<linux-hardening@vger.kernel.org>
Subject: Re: [PATCHv3] EDAC/mc: Use kzalloc_flex()
Date: Tue, 31 Mar 2026 09:28:47 -0600 [thread overview]
Message-ID: <4ce84891-3449-478e-990a-eb77f53a956d@embeddedor.com> (raw)
In-Reply-To: <20260331121840.GBacu7oF3AjjkLtcBZ@fat_crate.local>
On 3/31/26 06:18, Borislav Petkov wrote:
> On Mon, Mar 30, 2026 at 04:25:26PM -0700, Rosen Penev wrote:
>> On Mon, Mar 30, 2026 at 3:32 PM Borislav Petkov <bp@alien8.de> wrote:
>>>
>>> On Mon, Mar 30, 2026 at 02:26:10PM -0700, Rosen Penev wrote:
>>>>> Oh, hypothetical what-if. Yeah, pls drop all that gunk from commit messages
>>>>> pls and simply concentrate on why the patch exists.
>>>> Not sure what you mean.
>>>
>>> I mean this: a commit message should simply state why a patch exists. Here's
>>> what I did with yours:
>>>
>>> Convert struct mem_ctl_info to use flex array and use the new flex array
>>> helpers to enable runtime bounds checking, including annotating the array
>>> length member with __counted_by() for extra runtime analysis when requested.
>>>
>>> Move counter assignment immediately after allocation as required by
>>> __counted_by().
This is misinformation and should be phrased differently[1]
-Gustavo
[1] https://lore.kernel.org/linux-hardening/37378f49-437f-438b-ad6c-d60480feb306@embeddedor.com/
>>>
>>> Move memcpy() after the counter assignment so that it is initialized before
>>> the first reference to the flex array, as the new attribute requires.
>> Looks great.
>>>
>>> The idea is that when one reads the commit message months, or even years from
>>> now - something we all have to do on a daily basis - it should have all the
>>> necessary information why the change was done.
>>>
>>> And nothing else. The emphasis being on the latter part. In this case, what
>>> this should have been and what some tools can do when lines are magically
>>> ordered doesn't really matter. The change must be worth to exist for itself.
>>> In this case, runtime bounds checking, which is something we all want.
>
> Applied, thanks.
>
next prev parent reply other threads:[~2026-03-31 15:29 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-27 2:48 [PATCHv3] EDAC/mc: Use kzalloc_flex() Rosen Penev
2026-03-30 15:15 ` Borislav Petkov
2026-03-30 20:49 ` Rosen Penev
2026-03-30 21:11 ` Borislav Petkov
2026-03-30 21:26 ` Rosen Penev
2026-03-30 22:32 ` Borislav Petkov
2026-03-30 23:25 ` Rosen Penev
2026-03-31 12:18 ` Borislav Petkov
2026-03-31 15:28 ` Gustavo A. R. Silva [this message]
2026-03-31 17:14 ` Borislav Petkov
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=4ce84891-3449-478e-990a-eb77f53a956d@embeddedor.com \
--to=gustavo@embeddedor.com \
--cc=bp@alien8.de \
--cc=gustavoars@kernel.org \
--cc=kees@kernel.org \
--cc=linux-edac@vger.kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rosenp@gmail.com \
--cc=tony.luck@intel.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