net: macb: Validate the value of base_time properly
Subsystems (3)
PATCH 1/1 net: macb: Validate the value of base_time properly
In macb_taprio_setup_replace(), the value of start_time is being compared against zero which would never be true since start_time is an unsigned value. Due to this there is a chance that an incorrect config base time value can be used for computation.
Fix by checking the value of conf->base_time directly. This issue was reported by static coverity analyzer.
--- drivers/net/ethernet/cadence/macb_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/cadence/macb_main.c +1 -1
@@ -4104,7 +4104,7 @@ static int macb_taprio_setup_replace(struct net_device *ndev,return -EINVAL ; } -if (start_time <0 ) { +if (conf->base_time <0 ) {netdev_err (ndev,"Invalid base_time: must be 0 or positive, got %lld\n" , conf->base_time);return -ERANGE ;
Signature · 1 line
2.43.0
Quoted 10 lines · Chandra Mohan Sundar
In
macb_taprio_setup_replace(), the value ofstart_timeis being compared against zero which would never be true sincestart_timeis an unsigned value. Due to this there is a chance that an incorrect config base time value can be used for computation.Fix by checking the value of
conf->base_timedirectly. This issue was reported by static coverity analyzer.Fixes 89934dbf169e3 ("net: macb: Add TAPRIO traffic scheduling support")Signed-off-by Chandra Mohan Sundar <[email protected]>
Quoted 17 lines
--- drivers/net/ethernet/cadence/macb_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/ethernet/cadence/macb_main.c +1
-1@@ -4104,7 +4104,7 @@ static int macb_taprio_setup_replace(struct net_device *ndev,return -EINVAL ; } -if (start_time <0 ) { +if (conf->base_time <0 ) {netdev_err (ndev,"Invalid base_time: must be 0 or positive, got %lld\n" , conf->base_time);return -ERANGE ;
Signature · 1 line
🙏 Vineeth
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 9 lines · On Mon, 1 Sep 2025 21:59:19 +0530 you wrote:
In
macb_taprio_setup_replace(), the value ofstart_timeis being compared against zero which would never be true sincestart_timeis an unsigned value. Due to this there is a chance that an incorrect config base time value can be used for computation.Fix by checking the value of
conf->base_timedirectly. This issue was reported by static coverity analyzer.[...]
Here is the summary with links:
- [net-next] net: macb: Validate the value of base_time properly
https://git.kernel.org/netdev/net-next/c/3586018d5c3d
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html