public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fs/xattr: Annotate struct simple_xattr with __counted_by
@ 2025-11-09 13:23 Thorsten Blum
  0 siblings, 0 replies; only message in thread
From: Thorsten Blum @ 2025-11-09 13:23 UTC (permalink / raw)
  To: Kees Cook, Gustavo A. R. Silva
  Cc: Thorsten Blum, linux-kernel, linux-hardening

Add the __counted_by() compiler attribute to the flexible array member
'value' to improve access bounds-checking via CONFIG_UBSAN_BOUNDS and
CONFIG_FORTIFY_SOURCE.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
 include/linux/xattr.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/xattr.h b/include/linux/xattr.h
index 86b0d47984a1..2d0ccf99ee75 100644
--- a/include/linux/xattr.h
+++ b/include/linux/xattr.h
@@ -114,7 +114,7 @@ struct simple_xattr {
 	struct rb_node rb_node;
 	char *name;
 	size_t size;
-	char value[];
+	char value[] __counted_by(size);
 };
 
 void simple_xattrs_init(struct simple_xattrs *xattrs);
-- 
2.51.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2025-11-09 13:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-09 13:23 [PATCH] fs/xattr: Annotate struct simple_xattr with __counted_by Thorsten Blum

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