Linux Hardening
 help / color / mirror / Atom feed
From: "yebin (H)" <yebin10@huawei.com>
To: Thorsten Blum <thorsten.blum@toblux.com>, <tytso@mit.edu>,
	<adilger.kernel@dilger.ca>, <kees@kernel.org>,
	<gustavoars@kernel.org>
Cc: <linux-ext4@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-hardening@vger.kernel.org>
Subject: Re: [PATCH] ext4: Annotate struct ext4_xattr_inode_array with __counted_by()
Date: Tue, 30 Jul 2024 09:21:00 +0800	[thread overview]
Message-ID: <66A83FFC.7020802@huawei.com> (raw)
In-Reply-To: <20240729110454.346918-3-thorsten.blum@toblux.com>



On 2024/7/29 19:04, Thorsten Blum wrote:
> Add the __counted_by compiler attribute to the flexible array member
> inodes to improve access bounds-checking via CONFIG_UBSAN_BOUNDS and
> CONFIG_FORTIFY_SOURCE.
>
> Remove the now obsolete comment on the count field.
>
> Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com>
> ---
>   fs/ext4/xattr.h | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/ext4/xattr.h b/fs/ext4/xattr.h
> index bd97c4aa8177..e14fb19dc912 100644
> --- a/fs/ext4/xattr.h
> +++ b/fs/ext4/xattr.h
> @@ -130,8 +130,8 @@ struct ext4_xattr_ibody_find {
>   };
>   
>   struct ext4_xattr_inode_array {
> -	unsigned int count;		/* # of used items in the array */
> -	struct inode *inodes[];
> +	unsigned int count;
As the comment says, 'count' is the number of items in the array that 
have been used,
not the total number of items in the array. So I think this check was 
added incorrectly.
> +	struct inode *inodes[] __counted_by(count);
>   };
>   
>   extern const struct xattr_handler ext4_xattr_user_handler;


      parent reply	other threads:[~2024-07-30  1:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-29 11:04 [PATCH] ext4: Annotate struct ext4_xattr_inode_array with __counted_by() Thorsten Blum
2024-07-29 14:09 ` Gustavo A. R. Silva
2024-07-30 17:10   ` Thorsten Blum
2024-07-30  1:21 ` yebin (H) [this message]

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=66A83FFC.7020802@huawei.com \
    --to=yebin10@huawei.com \
    --cc=adilger.kernel@dilger.ca \
    --cc=gustavoars@kernel.org \
    --cc=kees@kernel.org \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=thorsten.blum@toblux.com \
    --cc=tytso@mit.edu \
    /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