From: Kees Cook <keescook@chromium.org>
To: Stephen Rothwell <sfr@canb.auug.org.au>,
Kent Overstreet <kent.overstreet@linux.dev>
Cc: Linux Next Mailing List <linux-next@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
linux-hardening@vger.kernel.org
Subject: Re: linux-next: Tree for Sep 12 (bcachefs)
Date: Wed, 13 Sep 2023 18:17:00 -0700 [thread overview]
Message-ID: <202309131803.6A3C1D05A@keescook> (raw)
In-Reply-To: <20230912152645.0868a96a@canb.auug.org.au>
On Tue, Sep 12, 2023 at 03:26:45PM +1000, Stephen Rothwell wrote:
> New tree: bcachefs
Thanks for going through and fixing all the fake flexible array members.
It looks much nicer. :)
I have some questions about the remaining "markers", for example:
$ git grep -A8 '\bkey_start\b' -- fs/bcachefs
fs/bcachefs/bcachefs_format.h: __u8 key_start[0];
...
fs/bcachefs/bcachefs_format.h- __u8 pad[sizeof(struct bkey) - 3];
--
fs/bcachefs/bkey.c: u8 *l = k->key_start;
Why isn't this just:
u8 *l = k->pad
and you can drop the marker?
And some seem entirely unused, like all of "struct bch_reflink_v".
And some are going to fail at runtime, since they're still zero-sized
and being used as an actual array:
struct bch_sb_field_journal_seq_blacklist {
struct bch_sb_field field;
struct journal_seq_blacklist_entry start[0];
__u64 _data[];
};
...
memmove(&bl->start[i],
&bl->start[i + 1],
sizeof(bl->start[0]) * (nr - i));
It looks like you just want a type union for the flexible array.
This can be done like this:
struct bch_sb_field_journal_seq_blacklist {
struct bch_sb_field field;
union {
DECLARE_FLEX_ARRAY(struct journal_seq_blacklist_entry, start);
DECLARE_FLEX_ARRAY(__u64, _data);
};
};
Hopefully that helps!
-Kees
--
Kees Cook
next prev parent reply other threads:[~2023-09-14 1:17 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-12 5:26 linux-next: Tree for Sep 12 Stephen Rothwell
2023-09-12 22:28 ` linux-next: Tree for Sep 12 (drivers/clk/imx/clk-imx8-acm.o) Randy Dunlap
2023-09-21 9:39 ` Abel Vesa
2023-09-12 22:50 ` linux-next: Tree for Sep 12 [drivers/pinctrl/nuvoton/pinctrl-npcm8xx.ko] Randy Dunlap
2023-09-12 23:36 ` linux-next: Tree for Sep 12 (bcachefs, objtool) Randy Dunlap
2023-09-13 21:08 ` Josh Poimboeuf
2023-09-13 21:39 ` Randy Dunlap
2023-09-13 23:06 ` Kent Overstreet
2023-09-14 13:41 ` Josh Poimboeuf
2023-09-14 1:01 ` Kees Cook
2023-09-14 13:51 ` Josh Poimboeuf
2023-09-14 16:51 ` Kees Cook
2023-09-14 19:15 ` Kent Overstreet
2023-09-14 1:17 ` Kees Cook [this message]
2023-09-14 19:38 ` linux-next: Tree for Sep 12 (bcachefs) Kent Overstreet
2023-09-14 20:13 ` Gustavo A. R. Silva
2023-09-15 0:20 ` Kees Cook
2023-09-19 21:23 ` Kent Overstreet
2023-09-20 15:21 ` Kees Cook
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=202309131803.6A3C1D05A@keescook \
--to=keescook@chromium.org \
--cc=kent.overstreet@linux.dev \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-next@vger.kernel.org \
--cc=sfr@canb.auug.org.au \
/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