Commit c9e4555
ptp: ocp: Limit signal/freq counts in summary output functions
The debugfs summary output could access uninitialized elements in
the freq_in[] and signal_out[] arrays, causing NULL pointer
dereferences and triggering a kernel Oops (page_fault_oops).
This patch adds u8 fields (nr_freq_in, nr_signal_out) to track the
number of initialized elements, with a maximum of 4 per array.
The summary output functions are updated to respect these limits,
preventing out-of-bounds access and ensuring safe array handling.
Widen the label variables because the change confuses GCC about
max length of the strings.
Fixes: ef61f55 ("ptp: ocp: add Adva timecard support")
Signed-off-by: Sagi Maimon <maimon.sagi@gmail.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
Link: https://patch.msgid.link/20250514073541.35817-1-maimon.sagi@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>1 parent c39b1bb commit c9e4555
1 file changed
+17
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
315 | 315 | | |
316 | 316 | | |
317 | 317 | | |
| 318 | + | |
| 319 | + | |
318 | 320 | | |
319 | 321 | | |
320 | 322 | | |
| |||
342 | 344 | | |
343 | 345 | | |
344 | 346 | | |
345 | | - | |
346 | | - | |
| 347 | + | |
| 348 | + | |
347 | 349 | | |
348 | 350 | | |
349 | 351 | | |
| |||
378 | 380 | | |
379 | 381 | | |
380 | 382 | | |
381 | | - | |
| 383 | + | |
382 | 384 | | |
383 | 385 | | |
384 | 386 | | |
| 387 | + | |
| 388 | + | |
385 | 389 | | |
386 | 390 | | |
387 | 391 | | |
| |||
2697 | 2701 | | |
2698 | 2702 | | |
2699 | 2703 | | |
| 2704 | + | |
| 2705 | + | |
2700 | 2706 | | |
2701 | 2707 | | |
2702 | 2708 | | |
| |||
2862 | 2868 | | |
2863 | 2869 | | |
2864 | 2870 | | |
| 2871 | + | |
| 2872 | + | |
2865 | 2873 | | |
2866 | 2874 | | |
2867 | 2875 | | |
| |||
2888 | 2896 | | |
2889 | 2897 | | |
2890 | 2898 | | |
| 2899 | + | |
| 2900 | + | |
2891 | 2901 | | |
2892 | 2902 | | |
2893 | 2903 | | |
| |||
4008 | 4018 | | |
4009 | 4019 | | |
4010 | 4020 | | |
4011 | | - | |
| 4021 | + | |
4012 | 4022 | | |
4013 | 4023 | | |
4014 | 4024 | | |
| |||
4031 | 4041 | | |
4032 | 4042 | | |
4033 | 4043 | | |
4034 | | - | |
| 4044 | + | |
4035 | 4045 | | |
4036 | 4046 | | |
4037 | 4047 | | |
| |||
4175 | 4185 | | |
4176 | 4186 | | |
4177 | 4187 | | |
4178 | | - | |
| 4188 | + | |
4179 | 4189 | | |
4180 | 4190 | | |
4181 | 4191 | | |
4182 | | - | |
| 4192 | + | |
4183 | 4193 | | |
4184 | 4194 | | |
4185 | 4195 | | |
| |||
0 commit comments