[PATCH] regmap: Annotate regmap_access_table members with __counted_by_ptr()

From: Thorsten Blum

Date: Mon Nov 02 2026 - 06:39:43 EST


Add __counted_by_ptr() to regmap_access_table::yes_ranges and
regmap_access_table::no_ranges to improve access bounds checking via
CONFIG_UBSAN_BOUNDS and CONFIG_FORTIFY_SOURCE.

Signed-off-by: Thorsten Blum <blum@xxxxxxxxxx>
---
include/linux/regmap.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index c8aebd148e08..a72f17ab6264 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -248,9 +248,9 @@ struct regmap_range {
* check function will return true. "no_ranges" are searched first.
*/
struct regmap_access_table {
- const struct regmap_range *yes_ranges;
+ const struct regmap_range *yes_ranges __counted_by_ptr(n_yes_ranges);
unsigned int n_yes_ranges;
- const struct regmap_range *no_ranges;
+ const struct regmap_range *no_ranges __counted_by_ptr(n_no_ranges);
unsigned int n_no_ranges;
};