int tp_created = 0;
 
 replay:
-       t = NLMSG_DATA(n);
+       t = nlmsg_data(n);
        protocol = TC_H_MIN(t->tcm_info);
        prio = TC_H_MAJ(t->tcm_info);
        nprio = prio;
        struct nlmsghdr  *nlh;
        unsigned char *b = skb_tail_pointer(skb);
 
-       nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*tcm), flags);
-       tcm = NLMSG_DATA(nlh);
+       nlh = nlmsg_put(skb, pid, seq, event, sizeof(*tcm), flags);
+       if (!nlh)
+               goto out_nlmsg_trim;
+       tcm = nlmsg_data(nlh);
        tcm->tcm_family = AF_UNSPEC;
        tcm->tcm__pad1 = 0;
        tcm->tcm__pad2 = 0;
        nlh->nlmsg_len = skb_tail_pointer(skb) - b;
        return skb->len;
 
-nlmsg_failure:
+out_nlmsg_trim:
 nla_put_failure:
        nlmsg_trim(skb, b);
        return -1;
        struct net_device *dev;
        struct Qdisc *q;
        struct tcf_proto *tp, **chain;
-       struct tcmsg *tcm = (struct tcmsg *)NLMSG_DATA(cb->nlh);
+       struct tcmsg *tcm = nlmsg_data(cb->nlh);
        unsigned long cl = 0;
        const struct Qdisc_class_ops *cops;
        struct tcf_dump_args arg;