ptp: ocp: off by in in ptp_ocp_tod_gnss_name()
Subsystems (5)
PATCH 1/1 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 <[email protected]>
--- drivers/ptp/ptp_ocp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ptp/ptp_ocp.c +1 -1
@@ -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]; }
Signature · 1 line
2.20.1
Quoted 5 lines · Dan Carpenter
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 <[email protected]>
Acked-by Richard Cochran <[email protected]>
Quoted 5 lines · Dan Carpenter
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 <[email protected]>
Acked-by Jonathan Lemon <[email protected]>
This patch was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:
Quoted 8 lines · On Mon, 7 Mar 2022 17:13:18 +0300 you wrote:
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 <[email protected]>--- drivers/ptp/ptp_ocp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Here is the summary with links:
- [net-next] ptp: ocp: off by in in ptp_ocp_tod_gnss_name()
https://git.kernel.org/netdev/net-next/c/72f00505f2d2
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html