mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thorsten Blum <thorsten.blum@linux.dev>
To: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
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 21:45:56 +0100	[thread overview]
Message-ID: <7F05D8B9-E13A-4331-895A-65D92649B42B@linux.dev> (raw)
In-Reply-To: <83a95dfe-533b-468c-8dd4-439157c0e1cf@embeddedor.com>

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)

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,
Thorsten

  reply	other threads:[~2024-11-11 20:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-11 20:01 Thorsten Blum
2024-11-11 20:20 ` Gustavo A. R. Silva
2024-11-11 20:45   ` Thorsten Blum [this message]
2024-11-11 21:03     ` Gustavo A. R. Silva

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=7F05D8B9-E13A-4331-895A-65D92649B42B@linux.dev \
    --to=thorsten.blum@linux.dev \
    --cc=andreas@gaisler.com \
    --cc=arnd@arndb.de \
    --cc=davem@davemloft.net \
    --cc=gustavo@embeddedor.com \
    --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 \
    /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

all inboxes | Powered by JetHome®