]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
taprio: fix wrong for loop condition in add_tc_entries()
authorTan Tee Min <tee.min.tan@linux.intel.com>
Fri, 2 Dec 2022 06:25:42 +0000 (14:25 +0800)
committerDavid Ahern <dsahern@kernel.org>
Fri, 2 Dec 2022 15:53:13 +0000 (08:53 -0700)
The for loop in add_tc_entries() mistakenly included the last entry
index+1. Fix it to correctly loop the max_sdu entry between tc=0 and
num_max_sdu_entries-1.

Fixes: b10a6509c195 ("taprio: support dumping and setting per-tc max SDU")
Signed-off-by: Tan Tee Min <tee.min.tan@linux.intel.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
tc/q_taprio.c

index ded385caf964d31fbf0a2e0d86ca532903801983..a7c01ae0cedbad57a8ab35d4eaf7526f67195a01 100644 (file)
@@ -157,7 +157,7 @@ static void add_tc_entries(struct nlmsghdr *n, __u32 max_sdu[TC_QOPT_MAX_QUEUE],
        struct rtattr *l;
        __u32 tc;
 
-       for (tc = 0; tc <= num_max_sdu_entries; tc++) {
+       for (tc = 0; tc < num_max_sdu_entries; tc++) {
                l = addattr_nest(n, 1024, TCA_TAPRIO_ATTR_TC_ENTRY | NLA_F_NESTED);
 
                addattr_l(n, 1024, TCA_TAPRIO_TC_ENTRY_INDEX, &tc, sizeof(tc));