From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
To: Thorsten Blum <thorsten.blum@linux.dev>
Cc: "David S. Miller" <davem@davemloft.net>,
Andreas Larsson <andreas@gaisler.com>,
Sam Ravnborg <sam@ravnborg.org>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@kernel.org>, Arnd Bergmann <arnd@arndb.de>,
linux-hardening@vger.kernel.org, sparclinux@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] sparc: Replace one-element array with flexible array member
Date: Mon, 11 Nov 2024 15:03:52 -0600 [thread overview]
Message-ID: <3fe26d01-d704-47a8-be65-750b6a945045@embeddedor.com> (raw)
In-Reply-To: <7F05D8B9-E13A-4331-895A-65D92649B42B@linux.dev>
On 11/11/24 14:45, Thorsten Blum wrote:
> On 11. Nov 2024, at 21:20, Gustavo A. R. Silva wrote:
>> On 11/11/24 14:01, Thorsten Blum wrote:
>>> Replace the deprecated one-element array with a modern flexible array
>>> member in the struct hvtramp_descr.
>>> Additionally, 15 unnecessary bytes are allocated for hdesc, but instead
>>
>> 15? unnecessary?
>
> hvtramp_mapping is 16 bytes and the size is calculated as follows:
>
> (16 * num_kernel_image_mappings - 1)
>
> which is 15 bytes too many for any number of mappings because hdesc
> includes the first map. It probably should have been:
>
> 16 * (num_kernel_image_mappings - 1)
Ah yes, that opening parenthesis before `sizeof(struct hvtramp_mapping)`
was misplaced.
>
> unless I'm missing something.
>
>> It seems this struct is a candidate for `__counted_by()`
>
> Yes, but sparc doesn't seem to support it?
>
>> Now the code is broken because it's allocating `num_kernel_image_mappings - 1`
>> elements instead of `num_kernel_image_mappings`.
>
> Ah sorry, missed that and will fix in v2 shortly.
Thanks
--
Gustavo
prev parent reply other threads:[~2024-11-11 21:04 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-11 20:01 [PATCH] sparc: Replace one-element array with flexible array member Thorsten Blum
2024-11-11 20:20 ` Gustavo A. R. Silva
2024-11-11 20:45 ` Thorsten Blum
2024-11-11 21:03 ` Gustavo A. R. Silva [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=3fe26d01-d704-47a8-be65-750b6a945045@embeddedor.com \
--to=gustavo@embeddedor.com \
--cc=andreas@gaisler.com \
--cc=arnd@arndb.de \
--cc=davem@davemloft.net \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=sam@ravnborg.org \
--cc=sparclinux@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=thorsten.blum@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;
as well as URLs for NNTP newsgroup(s).