]> granicus.if.org Git - libnl/commitdiff
htb: fix misplaced memset() overwriting already set htb prio option
authorThomas Graf <tgraf@suug.ch>
Fri, 12 Aug 2011 11:47:23 +0000 (13:47 +0200)
committerThomas Graf <tgraf@suug.ch>
Fri, 12 Aug 2011 11:47:23 +0000 (13:47 +0200)
Reported by Richard Cesar <spidla@spidlas.cz>

lib/route/qdisc/htb.c

index 4417b8ef5a5a5939d8574ab7e903b99dc434606f..f1d0e758fab67ac9ecc52483ccdd6054c0b74b5c 100644 (file)
@@ -217,12 +217,12 @@ static int htb_class_msg_fill(struct rtnl_tc *tc, void *data,
        if (!htb || !(htb->ch_mask & SCH_HTB_HAS_RATE))
                BUG();
 
+       memset(&opts, 0, sizeof(opts));
+
        /* if not set, zero (0) is used as priority */
        if (htb->ch_mask & SCH_HTB_HAS_PRIO)
                opts.prio = htb->ch_prio;
 
-       memset(&opts, 0, sizeof(opts));
-
        mtu = rtnl_tc_get_mtu(tc);
 
        rtnl_tc_build_rate_table(tc, &htb->ch_rate, rtable);