Commit ea9e148
Bluetooth: hci_conn: Use __counted_by() and avoid -Wfamnae warning
Prepare for the coming implementation by GCC and Clang of the
__counted_by attribute. Flexible array members annotated with
__counted_by can have their accesses bounds-checked at run-time
via CONFIG_UBSAN_BOUNDS (for array indexing) and CONFIG_FORTIFY_SOURCE
(for strcpy/memcpy-family functions).
Also, -Wflex-array-member-not-at-end is coming in GCC-14, and we are
getting ready to enable it globally.
So, use the `DEFINE_FLEX()` helper for an on-stack definition of
a flexible structure where the size of the flexible-array member
is known at compile-time, and refactor the rest of the code,
accordingly.
With these changes, fix the following warning:
net/bluetooth/hci_conn.c:669:41: warning: structure containing a
flexible array member is not at the end of another structure
[-Wflex-array-member-not-at-end]
Link: KSPP#202
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>1 parent 5c9f6a7 commit ea9e148
2 files changed
Lines changed: 17 additions & 23 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2143 | 2143 | | |
2144 | 2144 | | |
2145 | 2145 | | |
2146 | | - | |
| 2146 | + | |
2147 | 2147 | | |
2148 | 2148 | | |
2149 | 2149 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
664 | 664 | | |
665 | 665 | | |
666 | 666 | | |
667 | | - | |
668 | | - | |
669 | | - | |
670 | | - | |
671 | | - | |
672 | 667 | | |
673 | 668 | | |
674 | 669 | | |
| |||
1722 | 1717 | | |
1723 | 1718 | | |
1724 | 1719 | | |
| 1720 | + | |
1725 | 1721 | | |
1726 | 1722 | | |
1727 | 1723 | | |
1728 | | - | |
| 1724 | + | |
1729 | 1725 | | |
1730 | 1726 | | |
1731 | 1727 | | |
1732 | 1728 | | |
1733 | 1729 | | |
1734 | 1730 | | |
1735 | | - | |
1736 | | - | |
1737 | 1731 | | |
1738 | | - | |
1739 | | - | |
1740 | | - | |
1741 | | - | |
1742 | | - | |
1743 | | - | |
1744 | | - | |
1745 | | - | |
| 1732 | + | |
| 1733 | + | |
| 1734 | + | |
| 1735 | + | |
| 1736 | + | |
| 1737 | + | |
| 1738 | + | |
| 1739 | + | |
1746 | 1740 | | |
1747 | 1741 | | |
1748 | 1742 | | |
1749 | 1743 | | |
1750 | 1744 | | |
1751 | 1745 | | |
1752 | | - | |
| 1746 | + | |
1753 | 1747 | | |
1754 | 1748 | | |
1755 | 1749 | | |
| |||
1758 | 1752 | | |
1759 | 1753 | | |
1760 | 1754 | | |
1761 | | - | |
| 1755 | + | |
1762 | 1756 | | |
1763 | 1757 | | |
1764 | 1758 | | |
| |||
1769 | 1763 | | |
1770 | 1764 | | |
1771 | 1765 | | |
| 1766 | + | |
1772 | 1767 | | |
1773 | | - | |
| 1768 | + | |
1774 | 1769 | | |
1775 | 1770 | | |
1776 | 1771 | | |
1777 | | - | |
1778 | | - | |
1779 | | - | |
| 1772 | + | |
| 1773 | + | |
1780 | 1774 | | |
1781 | 1775 | | |
1782 | 1776 | | |
| |||
0 commit comments