From: Thorsten Blum Date: Tue, 15 Oct 2024 20:27:31 +0000 (+0200) Subject: nfs: Annotate struct pnfs_commit_array with __counted_by() X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=e8e26a0b09f5783be471b5ffb1e31822b1272c1d;p=users%2Fdwmw2%2Flinux.git nfs: Annotate struct pnfs_commit_array with __counted_by() Add the __counted_by compiler attribute to the flexible array member buckets to improve access bounds-checking via CONFIG_UBSAN_BOUNDS and CONFIG_FORTIFY_SOURCE. Compile-tested only. Signed-off-by: Thorsten Blum Signed-off-by: Trond Myklebust --- diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h index 12d8e47bc5a38..559273a0f16d8 100644 --- a/include/linux/nfs_xdr.h +++ b/include/linux/nfs_xdr.h @@ -1336,7 +1336,7 @@ struct pnfs_commit_array { struct rcu_head rcu; refcount_t refcount; unsigned int nbuckets; - struct pnfs_commit_bucket buckets[]; + struct pnfs_commit_bucket buckets[] __counted_by(nbuckets); }; struct pnfs_ds_commit_info {