]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
net: macb: Validate the value of base_time properly
authorChandra Mohan Sundar <chandramohan.explore@gmail.com>
Mon, 1 Sep 2025 16:29:19 +0000 (21:59 +0530)
committerJakub Kicinski <kuba@kernel.org>
Tue, 2 Sep 2025 23:39:29 +0000 (16:39 -0700)
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.

Fixes: 89934dbf169e3 ("net: macb: Add TAPRIO traffic scheduling support")
Signed-off-by: Chandra Mohan Sundar <chandramohan.explore@gmail.com>
Reviewed-by: Vineeth Karumanchi <vineeth.karumanchi@amd.com>
Link: https://patch.msgid.link/20250901162923.627765-1-chandramohan.explore@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/cadence/macb_main.c

index 290d67da704d87f9f9c834d64b437b3da86362de..e9b262a0223f8db30ff8a2207383686c3d6ad5c7 100644 (file)
@@ -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;