linux/drivers/ptp
Sagi Maimon c9e455581e 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: ef61f5528f ("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>
2025-05-16 15:43:44 -07:00
..
Kconfig
Makefile
ptp_chardev.c
ptp_clock.c
ptp_clockmatrix.c
ptp_clockmatrix.h
ptp_dfl_tod.c
ptp_dte.c
ptp_fc3.c
ptp_fc3.h
ptp_idt82p33.c
ptp_idt82p33.h
ptp_ines.c
ptp_kvm_arm.c
ptp_kvm_common.c
ptp_kvm_x86.c
ptp_mock.c
ptp_ocp.c ptp: ocp: Limit signal/freq counts in summary output functions 2025-05-16 15:43:44 -07:00
ptp_pch.c
ptp_private.h
ptp_qoriq_debugfs.c
ptp_qoriq.c
ptp_s390.c
ptp_sysfs.c
ptp_vclock.c
ptp_vmclock.c
ptp_vmw.c