From: Paulo Miguel Almeida <paulo.miguel.almeida.rodenas@gmail.com>
To: linux-hardening@vger.kernel.org
Subject: [RFC] Approaches to deal with a struct with multiple fake flexible arrays members
Date: Wed, 9 Nov 2022 16:45:42 +1300 [thread overview]
Message-ID: <Y2siZmiTD40mTYpJ@mail.google.com> (raw)
Hi KSPP community,
I've been working on replacing 1-element arrays with flex array members
on the drm/amdgpu files. I came across one insteresting case which I
may need to pick your brains to find a solution for it.
The structure below has two fake flexible arrays but I would get an
error if I try make them both FAM. How should/could I deal with the
asRegIndexBuf in this case? In theory, DECLARE_FLEX_ARRAY would "work"
but that doesn't seem to be its intended usage as far I've searched.
(unless I got it wrong, if that's the case, feel free to set me straight)
Any ideas?
struct _ATOM_INIT_REG_BLOCK {
USHORT usRegIndexTblSize; /* 0 2 */
USHORT usRegDataBlkSize; /* 2 2 */
ATOM_INIT_REG_INDEX_FORMAT asRegIndexBuf[1]; /* 4 3 */
ATOM_MEMORY_SETTING_DATA_BLOCK asRegDataBuf[1]; /* 7 8 */
/* size: 15, cachelines: 1, members: 4 */
/* last cacheline: 15 bytes */
} __attribute__((__packed__));
thanks!
- Paulo A.
next reply other threads:[~2022-11-09 3:45 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-09 3:45 Paulo Miguel Almeida [this message]
2022-11-10 0:45 ` [RFC] Approaches to deal with a struct with multiple fake flexible arrays members Gustavo A. R. Silva
2022-11-10 1:31 ` Paulo Miguel Almeida
2022-11-10 3:20 ` Alex Deucher
2022-11-11 5:39 ` Gustavo A. R. Silva
2022-11-11 6:05 ` Paulo Miguel Almeida
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=Y2siZmiTD40mTYpJ@mail.google.com \
--to=paulo.miguel.almeida.rodenas@gmail.com \
--cc=linux-hardening@vger.kernel.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