mirror of
https://github.com/torvalds/linux.git
synced 2026-05-22 06:01:53 +02:00
ptp: ocp: off by in in ptp_ocp_tod_gnss_name()
The > ARRAY_SIZE() needs to be >= ARRAY_SIZE() to prevent an out of
bounds access.
Fixes: 9f492c4cb2 ("ptp: ocp: add TOD debug information")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Richard Cochran <richardcochran@gmail.com>
Acked-by: Jonathan Lemon <jonathan.lemon@gmail.com>
Link: https://lore.kernel.org/r/20220307141318.GA18867@kili
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
57d29a2935
commit
72f00505f2
|
|
@ -914,7 +914,7 @@ ptp_ocp_tod_gnss_name(int idx)
|
|||
"ALL", "COMBINED", "GPS", "GLONASS", "GALILEO", "BEIDOU",
|
||||
"Unknown"
|
||||
};
|
||||
if (idx > ARRAY_SIZE(gnss_name))
|
||||
if (idx >= ARRAY_SIZE(gnss_name))
|
||||
idx = ARRAY_SIZE(gnss_name) - 1;
|
||||
return gnss_name[idx];
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user