public inbox for linux-hardening@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC] Approaches to deal with a struct with multiple fake flexible arrays members
@ 2022-11-09  3:45 Paulo Miguel Almeida
  2022-11-10  0:45 ` Gustavo A. R. Silva
  0 siblings, 1 reply; 6+ messages in thread
From: Paulo Miguel Almeida @ 2022-11-09  3:45 UTC (permalink / raw)
  To: linux-hardening

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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-11-11  6:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-09  3:45 [RFC] Approaches to deal with a struct with multiple fake flexible arrays members Paulo Miguel Almeida
2022-11-10  0:45 ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox