···26132613 type -= RTM_BASE;2614261426152615 /* All the messages must have at least 1 byte length */26162616- if (nlh->nlmsg_len < NLMSG_LENGTH(sizeof(struct rtgenmsg)))26162616+ if (nlmsg_len(nlh) < sizeof(struct rtgenmsg))26172617 return 0;2618261826192619- family = ((struct rtgenmsg *)NLMSG_DATA(nlh))->rtgen_family;26192619+ family = ((struct rtgenmsg *)nlmsg_data(nlh))->rtgen_family;26202620 sz_idx = type>>2;26212621 kind = type&3;26222622
···6565int ieee802154_nl_mcast(struct sk_buff *msg, unsigned int group)6666{6767 /* XXX: nlh is right at the start of msg */6868- void *hdr = genlmsg_data(NLMSG_DATA(msg->data));6868+ void *hdr = genlmsg_data(nlmsg_data(msg->data));69697070 if (genlmsg_end(msg, hdr) < 0)7171 goto out;···9898int ieee802154_nl_reply(struct sk_buff *msg, struct genl_info *info)9999{100100 /* XXX: nlh is right at the start of msg */101101- void *hdr = genlmsg_data(NLMSG_DATA(msg->data));101101+ void *hdr = genlmsg_data(nlmsg_data(msg->data));102102103103 if (genlmsg_end(msg, hdr) < 0)104104 goto out;
···2424#include <linux/skbuff.h>2525#include <asm/uaccess.h>2626#include <net/sock.h>2727-#include <net/netlink.h>2827#include <linux/init.h>29283030-#include <linux/netlink.h>2929+#include <net/netlink.h>3130#include <linux/netfilter/nfnetlink.h>32313332MODULE_LICENSE("GPL");···143144 return -EPERM;144145145146 /* All the messages must at least contain nfgenmsg */146146- if (nlh->nlmsg_len < NLMSG_LENGTH(sizeof(struct nfgenmsg)))147147+ if (nlmsg_len(nlh) < sizeof(struct nfgenmsg))147148 return 0;148149149150 type = nlh->nlmsg_type;···171172 }172173173174 {174174- int min_len = NLMSG_SPACE(sizeof(struct nfgenmsg));175175+ int min_len = nlmsg_total_size(sizeof(struct nfgenmsg));175176 u_int8_t cb_id = NFNL_MSG_TYPE(nlh->nlmsg_type);176177 struct nlattr *cda[ss->cb[cb_id].attr_count + 1];177178 struct nlattr *attr = (void *)nlh + min_len;
+2-2
net/netfilter/nfnetlink_log.c
···1919#include <linux/ipv6.h>2020#include <linux/netdevice.h>2121#include <linux/netfilter.h>2222-#include <linux/netlink.h>2222+#include <net/netlink.h>2323#include <linux/netfilter/nfnetlink.h>2424#include <linux/netfilter/nfnetlink_log.h>2525#include <linux/spinlock.h>···609609 /* FIXME: do we want to make the size calculation conditional based on610610 * what is actually present? way more branches and checks, but more611611 * memory efficient... */612612- size = NLMSG_SPACE(sizeof(struct nfgenmsg))612612+ size = nlmsg_total_size(sizeof(struct nfgenmsg))613613 + nla_total_size(sizeof(struct nfulnl_msg_packet_hdr))614614 + nla_total_size(sizeof(u_int32_t)) /* ifindex */615615 + nla_total_size(sizeof(u_int32_t)) /* ifindex */
···2222#include <linux/skbuff.h>2323#include <linux/init.h>2424#include <linux/kmod.h>2525-#include <linux/netlink.h>2525+#include <net/netlink.h>2626#include <linux/err.h>2727#include <linux/slab.h>2828#include <net/net_namespace.h>···428428 const struct Qdisc_class_ops *cops;429429 struct tcf_dump_args arg;430430431431- if (cb->nlh->nlmsg_len < NLMSG_LENGTH(sizeof(*tcm)))431431+ if (nlmsg_len(cb->nlh) < sizeof(*tcm))432432 return skb->len;433433 dev = __dev_get_by_index(net, tcm->tcm_ifindex);434434 if (!dev)
+1-1
net/sched/sch_api.c
···16421642 struct net_device *dev;16431643 int t, s_t;1644164416451645- if (cb->nlh->nlmsg_len < NLMSG_LENGTH(sizeof(*tcm)))16451645+ if (nlmsg_len(cb->nlh) < sizeof(*tcm))16461646 return 0;16471647 dev = dev_get_by_index(net, tcm->tcm_ifindex);16481648 if (!dev)