Commit bcd301a
iio: trx-rf: ad9088: fix __counted_by misuse in ad9088_clk_register()
clk_hw_onecell_data::hws is a flexible array annotated with
__counted_by(num). Using hws[num++] to append clocks is, in theory,
correct from a sequence point perspective (the post-increment in a
subscript is well-defined in C), but it triggers -Wsequence-point
warnings with recent GCC versions. More importantly, it violates the
__counted_by contract: the array is accessed at index num before the
counter is incremented, triggering runtime UBSAN bounds checks.
Fix this by indexing hws with the source enum directly (which already
indexes into phy->clks[]) and setting clk_data->num once upfront in
ad9088_probe().
Signed-off-by: Nuno Sá <nuno.sa@analog.com>
(cherry picked from commit 91f00ab)1 parent d620181 commit bcd301a
1 file changed
+6
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1156 | 1156 | | |
1157 | 1157 | | |
1158 | 1158 | | |
1159 | | - | |
| 1159 | + | |
1160 | 1160 | | |
1161 | 1161 | | |
1162 | 1162 | | |
| |||
5148 | 5148 | | |
5149 | 5149 | | |
5150 | 5150 | | |
| 5151 | + | |
| 5152 | + | |
| 5153 | + | |
| 5154 | + | |
| 5155 | + | |
5151 | 5156 | | |
5152 | 5157 | | |
5153 | 5158 | | |
| |||
0 commit comments