diff options
author | Dan Carpenter | 2022-03-07 17:13:18 +0300 |
---|---|---|
committer | Jakub Kicinski | 2022-03-07 15:12:05 -0800 |
commit | 72f00505f2d2eced9789e98ca081f8229f03b2ed (patch) | |
tree | fb472a56c54fb7d3fe43cef3a07518107e81aee2 /drivers/ptp | |
parent | 57d29a2935c9aab0aaef6264bf6a58aad3859e7c (diff) |
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: 9f492c4cb235 ("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>
Diffstat (limited to 'drivers/ptp')
-rw-r--r-- | drivers/ptp/ptp_ocp.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/ptp/ptp_ocp.c b/drivers/ptp/ptp_ocp.c index aaefca6c2422..334435e77b2f 100644 --- a/drivers/ptp/ptp_ocp.c +++ b/drivers/ptp/ptp_ocp.c @@ -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]; } |