From: Johannes Thumshirn <Johannes.Thumshirn@wdc.com>
To: Thorsten Blum <thorsten.blum@toblux.com>,
"clm@fb.com" <clm@fb.com>,
"josef@toxicpanda.com" <josef@toxicpanda.com>,
"dsterba@suse.com" <dsterba@suse.com>,
"kees@kernel.org" <kees@kernel.org>,
"gustavoars@kernel.org" <gustavoars@kernel.org>
Cc: "linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-hardening@vger.kernel.org"
<linux-hardening@vger.kernel.org>
Subject: Re: [PATCH] btrfs: Annotate structs with __counted_by()
Date: Mon, 12 Aug 2024 10:54:49 +0000 [thread overview]
Message-ID: <e7cbec5f-269a-410c-bb5a-e00de15078f6@wdc.com> (raw)
In-Reply-To: <20240812103619.2720-2-thorsten.blum@toblux.com>
On 12.08.24 12:37, Thorsten Blum wrote:
> Add the __counted_by compiler attribute to the flexible array member
> stripes to improve access bounds-checking via CONFIG_UBSAN_BOUNDS and
> CONFIG_FORTIFY_SOURCE.
>
> Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com>
> ---
> fs/btrfs/volumes.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
> index 37a09ebb34dd..f28fa318036b 100644
> --- a/fs/btrfs/volumes.h
> +++ b/fs/btrfs/volumes.h
> @@ -551,7 +551,7 @@ struct btrfs_io_context {
> * stripes[data_stripes + 1]: The Q stripe (only for RAID6).
> */
> u64 full_stripe_logical;
> - struct btrfs_io_stripe stripes[];
> + struct btrfs_io_stripe stripes[] __counted_by(num_stripes);
> };
>
> struct btrfs_device_info {
> @@ -591,7 +591,7 @@ struct btrfs_chunk_map {
> int io_width;
> int num_stripes;
> int sub_stripes;
> - struct btrfs_io_stripe stripes[];
> + struct btrfs_io_stripe stripes[] __counted_by(num_stripes);
> };
>
> #define btrfs_chunk_map_size(n) (sizeof(struct btrfs_chunk_map) + \
Looks good to me,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Out of curiosity, have you encountered any issues with this patch applied?
next prev parent reply other threads:[~2024-08-12 10:54 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-12 10:36 Thorsten Blum
2024-08-12 10:54 ` Johannes Thumshirn [this message]
2024-08-12 12:03 ` Thorsten Blum
2024-08-14 18:02 ` Nathan Chancellor
2024-08-14 19:01 ` Thorsten Blum
2024-08-14 19:26 ` David Sterba
2024-08-12 11:31 ` David Sterba
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=e7cbec5f-269a-410c-bb5a-e00de15078f6@wdc.com \
--to=johannes.thumshirn@wdc.com \
--cc=clm@fb.com \
--cc=dsterba@suse.com \
--cc=gustavoars@kernel.org \
--cc=josef@toxicpanda.com \
--cc=kees@kernel.org \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=thorsten.blum@toblux.com \
/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®