diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2022-03-07 15:13:18 +0100 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2022-03-08 00:12:05 +0100 |
commit | 72f00505f2d2eced9789e98ca081f8229f03b2ed (patch) | |
tree | fb472a56c54fb7d3fe43cef3a07518107e81aee2 /drivers/ptp | |
parent | net: rtnetlink: fix error handling in rtnl_fill_statsinfo() (diff) | |
download | linux-72f00505f2d2eced9789e98ca081f8229f03b2ed.tar.xz linux-72f00505f2d2eced9789e98ca081f8229f03b2ed.zip |
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]; } |