diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2007-04-25 22:08:35 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-04-26 01:26:34 -0400 |
commit | b529ccf2799c14346d1518e9bdf1f88f03643e99 (patch) | |
tree | f899a5a5d66d2ca21724c1871ee3afeda6c4a670 /net | |
parent | 965ffea43d4ebe8cd7b9fee78d651268dd7d23c5 (diff) |
[NETLINK]: Introduce nlmsg_hdr() helper
For the common "(struct nlmsghdr *)skb->data" sequence, so that we reduce the
number of direct accesses to skb->data and for consistency with all the other
cast skb member helpers.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/decnet/netfilter/dn_rtmsg.c | 2 | ||||
-rw-r--r-- | net/ipv4/fib_frontend.c | 2 | ||||
-rw-r--r-- | net/ipv4/inet_diag.c | 2 | ||||
-rw-r--r-- | net/ipv4/netfilter/ip_queue.c | 2 | ||||
-rw-r--r-- | net/ipv6/netfilter/ip6_queue.c | 2 | ||||
-rw-r--r-- | net/netlink/af_netlink.c | 2 | ||||
-rw-r--r-- | net/tipc/netlink.c | 2 |
7 files changed, 7 insertions, 7 deletions
diff --git a/net/decnet/netfilter/dn_rtmsg.c b/net/decnet/netfilter/dn_rtmsg.c index ceefd9dd0c92..9e8256a2361e 100644 --- a/net/decnet/netfilter/dn_rtmsg.c +++ b/net/decnet/netfilter/dn_rtmsg.c | |||
@@ -102,7 +102,7 @@ static unsigned int dnrmg_hook(unsigned int hook, | |||
102 | 102 | ||
103 | static inline void dnrmg_receive_user_skb(struct sk_buff *skb) | 103 | static inline void dnrmg_receive_user_skb(struct sk_buff *skb) |
104 | { | 104 | { |
105 | struct nlmsghdr *nlh = (struct nlmsghdr *)skb->data; | 105 | struct nlmsghdr *nlh = nlmsg_hdr(skb); |
106 | 106 | ||
107 | if (nlh->nlmsg_len < sizeof(*nlh) || skb->len < nlh->nlmsg_len) | 107 | if (nlh->nlmsg_len < sizeof(*nlh) || skb->len < nlh->nlmsg_len) |
108 | return; | 108 | return; |
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c index cac06c43f004..3ff753c6f197 100644 --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c | |||
@@ -807,7 +807,7 @@ static void nl_fib_input(struct sock *sk, int len) | |||
807 | if (skb == NULL) | 807 | if (skb == NULL) |
808 | return; | 808 | return; |
809 | 809 | ||
810 | nlh = (struct nlmsghdr *)skb->data; | 810 | nlh = nlmsg_hdr(skb); |
811 | if (skb->len < NLMSG_SPACE(0) || skb->len < nlh->nlmsg_len || | 811 | if (skb->len < NLMSG_SPACE(0) || skb->len < nlh->nlmsg_len || |
812 | nlh->nlmsg_len < NLMSG_LENGTH(sizeof(*frn))) { | 812 | nlh->nlmsg_len < NLMSG_LENGTH(sizeof(*frn))) { |
813 | kfree_skb(skb); | 813 | kfree_skb(skb); |
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c index 37362cd1d07f..238999e6e871 100644 --- a/net/ipv4/inet_diag.c +++ b/net/ipv4/inet_diag.c | |||
@@ -847,7 +847,7 @@ static inline void inet_diag_rcv_skb(struct sk_buff *skb) | |||
847 | { | 847 | { |
848 | if (skb->len >= NLMSG_SPACE(0)) { | 848 | if (skb->len >= NLMSG_SPACE(0)) { |
849 | int err; | 849 | int err; |
850 | struct nlmsghdr *nlh = (struct nlmsghdr *)skb->data; | 850 | struct nlmsghdr *nlh = nlmsg_hdr(skb); |
851 | 851 | ||
852 | if (nlh->nlmsg_len < sizeof(*nlh) || | 852 | if (nlh->nlmsg_len < sizeof(*nlh) || |
853 | skb->len < nlh->nlmsg_len) | 853 | skb->len < nlh->nlmsg_len) |
diff --git a/net/ipv4/netfilter/ip_queue.c b/net/ipv4/netfilter/ip_queue.c index 15e0d2002235..17f7c988460c 100644 --- a/net/ipv4/netfilter/ip_queue.c +++ b/net/ipv4/netfilter/ip_queue.c | |||
@@ -497,7 +497,7 @@ ipq_rcv_skb(struct sk_buff *skb) | |||
497 | if (skblen < sizeof(*nlh)) | 497 | if (skblen < sizeof(*nlh)) |
498 | return; | 498 | return; |
499 | 499 | ||
500 | nlh = (struct nlmsghdr *)skb->data; | 500 | nlh = nlmsg_hdr(skb); |
501 | nlmsglen = nlh->nlmsg_len; | 501 | nlmsglen = nlh->nlmsg_len; |
502 | if (nlmsglen < sizeof(*nlh) || skblen < nlmsglen) | 502 | if (nlmsglen < sizeof(*nlh) || skblen < nlmsglen) |
503 | return; | 503 | return; |
diff --git a/net/ipv6/netfilter/ip6_queue.c b/net/ipv6/netfilter/ip6_queue.c index 5cfce218c5e1..275e625e4977 100644 --- a/net/ipv6/netfilter/ip6_queue.c +++ b/net/ipv6/netfilter/ip6_queue.c | |||
@@ -487,7 +487,7 @@ ipq_rcv_skb(struct sk_buff *skb) | |||
487 | if (skblen < sizeof(*nlh)) | 487 | if (skblen < sizeof(*nlh)) |
488 | return; | 488 | return; |
489 | 489 | ||
490 | nlh = (struct nlmsghdr *)skb->data; | 490 | nlh = nlmsg_hdr(skb); |
491 | nlmsglen = nlh->nlmsg_len; | 491 | nlmsglen = nlh->nlmsg_len; |
492 | if (nlmsglen < sizeof(*nlh) || skblen < nlmsglen) | 492 | if (nlmsglen < sizeof(*nlh) || skblen < nlmsglen) |
493 | return; | 493 | return; |
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index 50dc5edb7752..04b72d3c1dea 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c | |||
@@ -1471,7 +1471,7 @@ static int netlink_rcv_skb(struct sk_buff *skb, int (*cb)(struct sk_buff *, | |||
1471 | int err; | 1471 | int err; |
1472 | 1472 | ||
1473 | while (skb->len >= nlmsg_total_size(0)) { | 1473 | while (skb->len >= nlmsg_total_size(0)) { |
1474 | nlh = (struct nlmsghdr *) skb->data; | 1474 | nlh = nlmsg_hdr(skb); |
1475 | 1475 | ||
1476 | if (nlh->nlmsg_len < NLMSG_HDRLEN || skb->len < nlh->nlmsg_len) | 1476 | if (nlh->nlmsg_len < NLMSG_HDRLEN || skb->len < nlh->nlmsg_len) |
1477 | return 0; | 1477 | return 0; |
diff --git a/net/tipc/netlink.c b/net/tipc/netlink.c index b8e1edc2badc..4cdafa2d1d4d 100644 --- a/net/tipc/netlink.c +++ b/net/tipc/netlink.c | |||
@@ -57,7 +57,7 @@ static int handle_cmd(struct sk_buff *skb, struct genl_info *info) | |||
57 | 57 | ||
58 | if (rep_buf) { | 58 | if (rep_buf) { |
59 | skb_push(rep_buf, hdr_space); | 59 | skb_push(rep_buf, hdr_space); |
60 | rep_nlh = (struct nlmsghdr *)rep_buf->data; | 60 | rep_nlh = nlmsg_hdr(rep_buf); |
61 | memcpy(rep_nlh, req_nlh, hdr_space); | 61 | memcpy(rep_nlh, req_nlh, hdr_space); |
62 | rep_nlh->nlmsg_len = rep_buf->len; | 62 | rep_nlh->nlmsg_len = rep_buf->len; |
63 | genlmsg_unicast(rep_buf, req_nlh->nlmsg_pid); | 63 | genlmsg_unicast(rep_buf, req_nlh->nlmsg_pid); |