diff mbox series

[v8,29/35] dyndbg: add __counted_by annotations

Message ID 20240429193921.66648-10-jim.cromie@gmail.com (mailing list archive)
State New, archived
Headers show
Series None | expand

Commit Message

Jim Cromie April 29, 2024, 7:39 p.m. UTC
Tell the compiler about our vectors (array,length), in 2 places:

h: struct _ddebug_info, which keeps refs to the __dyndbg_* ELF/DATA
sections, these are all vectors with a length.

c: struct ddebug_table, which has sub-refs into _ddebug_info.*

Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
---
 include/linux/dynamic_debug.h | 6 +++---
 lib/dynamic_debug.c           | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

Comments

Jim Cromie April 30, 2024, 6:49 p.m. UTC | #1
On Mon, Apr 29, 2024 at 1:39 PM Jim Cromie <jim.cromie@gmail.com> wrote:
>
> Tell the compiler about our vectors (array,length), in 2 places:
>

these are not flex-arrays,  using counted-by is wrong here.

Ive dropped this commit, series rebases clean wo it.


> h: struct _ddebug_info, which keeps refs to the __dyndbg_* ELF/DATA
> sections, these are all vectors with a length.
>
diff mbox series

Patch

diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h
index 090fe9554db7..c54d2a4e1d48 100644
--- a/include/linux/dynamic_debug.h
+++ b/include/linux/dynamic_debug.h
@@ -146,9 +146,9 @@  struct ddebug_class_user {
 
 /* encapsulate linker provided built-in (or module) dyndbg data */
 struct _ddebug_info {
-	struct _ddebug *descs;
-	struct ddebug_class_map *classes;
-	struct ddebug_class_user *class_users;
+	struct _ddebug *descs __counted_by(num_descs);
+	struct ddebug_class_map *classes __counted_by(num_classes);
+	struct ddebug_class_user *class_users __counted_by(num_class_users);
 	unsigned int num_descs;
 	unsigned int num_classes;
 	unsigned int num_class_users;
diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
index 625838bd74aa..390a35508fb6 100644
--- a/lib/dynamic_debug.c
+++ b/lib/dynamic_debug.c
@@ -49,9 +49,9 @@  extern struct ddebug_class_user __stop___dyndbg_class_users[];
 struct ddebug_table {
 	struct list_head link;
 	const char *mod_name;
-	struct _ddebug *ddebugs;
-	struct ddebug_class_map *classes;
-	struct ddebug_class_user *class_users;
+	struct _ddebug *ddebugs __counted_by(num_ddebugs);
+	struct ddebug_class_map *classes __counted_by(num_classes);
+	struct ddebug_class_user *class_users __counted_by(num_class_users);
 	unsigned int num_ddebugs, num_classes, num_class_users;
 };