diff --git a/kernel/module/sysfs.c b/kernel/module/sysfs.c
index c921bf044050ff5650394372d400517c83e87bc8..d964167c66586807a783316dc1873ea1d824e3e0 100644
--- a/kernel/module/sysfs.c
+++ b/kernel/module/sysfs.c
@@ -143,7 +143,7 @@ static void remove_sect_attrs(struct module *mod)
 struct module_notes_attrs {
 	struct kobject *dir;
 	unsigned int notes;
-	struct bin_attribute attrs[];
+	struct bin_attribute attrs[] __counted_by(notes);
 };
 
 static ssize_t module_notes_read(struct file *filp, struct kobject *kobj,