Commit 3690f4a
params: Annotate struct module_param_attrs with __counted_by()
Add the __counted_by compiler attribute to the flexible array member
attrs to improve access bounds-checking via CONFIG_UBSAN_BOUNDS and
CONFIG_FORTIFY_SOURCE.
Increment num before adding a new param_attribute to the attrs array and
adjust the array index accordingly. Increment num immediately after the
first reallocation such that the reallocation for the NULL terminator
only needs to add 1 (instead of 2) to mk->mp->num.
Use struct_size() instead of manually calculating the size for the
reallocation.
Use krealloc_array() for the additional NULL terminator.
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Luis Chamberlain <mcgrof@kernel.org>
Cc: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Reviewed-by: Luis Chamberlain <mcgrof@kernel.org>
Link: https://lore.kernel.org/r/20250213221352.2625-3-thorsten.blum@linux.dev
Signed-off-by: Petr Pavlu <petr.pavlu@suse.com>1 parent f47d2a3 commit 3690f4a
1 file changed
+13
-16
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
551 | 551 | | |
552 | 552 | | |
553 | 553 | | |
554 | | - | |
| 554 | + | |
555 | 555 | | |
556 | 556 | | |
557 | 557 | | |
| |||
651 | 651 | | |
652 | 652 | | |
653 | 653 | | |
654 | | - | |
655 | | - | |
656 | | - | |
| 654 | + | |
657 | 655 | | |
658 | 656 | | |
659 | 657 | | |
660 | 658 | | |
| 659 | + | |
661 | 660 | | |
662 | 661 | | |
663 | | - | |
664 | | - | |
665 | | - | |
| 662 | + | |
| 663 | + | |
666 | 664 | | |
667 | 665 | | |
668 | 666 | | |
669 | 667 | | |
670 | 668 | | |
671 | | - | |
672 | | - | |
673 | | - | |
674 | | - | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
675 | 673 | | |
676 | 674 | | |
677 | | - | |
| 675 | + | |
678 | 676 | | |
679 | | - | |
680 | | - | |
681 | | - | |
682 | | - | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
683 | 680 | | |
684 | 681 | | |
685 | 682 | | |
| |||
0 commit comments