Skip to contentSkip to conversation

ovl: Annotate struct ovl_entry with __counted_by()

PATCH Applied Thorsten Blum 2 participants 2 messages May 3, 2025 – May 5, 2025 Overlay filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ovl: Annotate struct ovl_entry with __counted_by()

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

---
 fs/overlayfs/ovl_entry.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/overlayfs/ovl_entry.h +1 -1
index cb449ab310a7..afb7762f873f 100644
@@ -51,7 +51,7 @@ struct ovl_path {
 
 struct ovl_entry {
 	unsigned int __numlower;
-	struct ovl_path __lowerstack[];
+	struct ovl_path __lowerstack[] __counted_by(__numlower);
 };
 
 /* private information held for overlayfs's superblock */
Signature · 1 line
2.49.0
maintainer Applied
#1 lore raw
Quoted 6 lines · Thorsten Blum

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

Applied, thanks.

Miklos