net: pse-pd: Fix out of bound for loop
Subsystems (3)
Kory Maincent
maintainerPATCH 1/1 net: pse-pd: Fix out of bound for loop
Adjust the loop limit to prevent out-of-bounds access when iterating over PI structures. The loop should not reach the index pcdev->nr_lines since we allocate exactly pcdev->nr_lines number of PI structures. This fix ensures proper bounds are maintained during iterations.
--- drivers/net/pse-pd/pse_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/pse-pd/pse_core.c +2 -2
@@ -113,7 +113,7 @@ static void pse_release_pis(struct pse_controller_dev *pcdev) {int i; -for (i =0 ; i <= pcdev->nr_lines; i++) { +for (i =0 ; i < pcdev->nr_lines; i++) {of_node_put (pcdev->pi[i].pairset[0 ].np);of_node_put (pcdev->pi[i].pairset[1 ].np);of_node_put (pcdev->pi[i].np);
@@ -647,7 +647,7 @@ static int of_pse_match_pi(struct pse_controller_dev *pcdev, {int i; -for (i =0 ; i <= pcdev->nr_lines; i++) { +for (i =0 ; i < pcdev->nr_lines; i++) {if (pcdev->pi[i].np == np)return i; }
Signature · 1 line
2.34.1
Quoted 7 lines · Kory Maincent
Adjust the loop limit to prevent out-of-bounds access when iterating over PI structures. The loop should not reach the index
pcdev->nr_linessince we allocate exactlypcdev->nr_linesnumber of PI structures. This fix ensures proper bounds are maintained during iterations.Fixes 9be9567a7c59 ("net: pse-pd: Add support for PSE PIs")Signed-off-by Kory Maincent <[email protected]>
Quoted 7 lines · Kory Maincent
Adjust the loop limit to prevent out-of-bounds access when iterating over PI structures. The loop should not reach the index
pcdev->nr_linessince we allocate exactlypcdev->nr_linesnumber of PI structures. This fix ensures proper bounds are maintained during iterations.Fixes 9be9567a7c59 ("net: pse-pd: Add support for PSE PIs")Signed-off-by Kory Maincent <[email protected]>
Thank you!
Signature · 4 lines
Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
This patch was applied to netdev/net.git (main) by Andrew Lunn <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Andrew Lunn <[email protected]>:
Quoted 9 lines · On Tue, 15 Oct 2024 15:02:54 +0200 you wrote:
Adjust the loop limit to prevent out-of-bounds access when iterating over PI structures. The loop should not reach the index
pcdev->nr_linessince we allocate exactlypcdev->nr_linesnumber of PI structures. This fix ensures proper bounds are maintained during iterations.Fixes 9be9567a7c59 ("net: pse-pd: Add support for PSE PIs")Signed-off-by Kory Maincent <[email protected]>[...]
Here is the summary with links:
- [net] net: pse-pd: Fix out of bound for loop
https://git.kernel.org/netdev/net/c/f2767a41959e
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html