[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240813105314.58484-2-thorsten.blum@toblux.com>
Date: Tue, 13 Aug 2024 12:53:15 +0200
From: Thorsten Blum <thorsten.blum@...lux.com>
To: clm@...com,
	josef@...icpanda.com,
	dsterba@...e.com,
	kees@...nel.org,
	gustavoars@...nel.org
Cc: linux-btrfs@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	linux-hardening@...r.kernel.org,
	Thorsten Blum <thorsten.blum@...lux.com>
Subject: [PATCH] btrfs: Annotate struct name_cache_entry with __counted_by()
Add the __counted_by compiler attribute to the flexible array member
name to improve access bounds-checking via CONFIG_UBSAN_BOUNDS and
CONFIG_FORTIFY_SOURCE.
Signed-off-by: Thorsten Blum <thorsten.blum@...lux.com>
---
 fs/btrfs/send.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
index 4ca711a773ef..de185b23cfd0 100644
--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -347,7 +347,7 @@ struct name_cache_entry {
 	int ret;
 	int need_later_update;
 	int name_len;
-	char name[];
+	char name[] __counted_by(name_len);
 };
 
 /* See the comment at lru_cache.h about struct btrfs_lru_cache_entry. */
-- 
2.46.0
Powered by blists - more mailing lists
 
