Commit dc5fc579 authored by Arnaldo Carvalho de Melo's avatar Arnaldo Carvalho de Melo Committed by David S. Miller
Browse files

[NETLINK]: Use nlmsg_trim() where appropriate

parent a36ca733
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -548,7 +548,7 @@ static inline void *nlmsg_get_pos(struct sk_buff *skb)
 *
 * Trims the message to the provided mark. Returns -1.
 */
static inline int nlmsg_trim(struct sk_buff *skb, void *mark)
static inline int nlmsg_trim(struct sk_buff *skb, const void *mark)
{
	if (mark)
		skb_trim(skb, (unsigned char *) mark - skb->data);
+1 −1
Original line number Diff line number Diff line
@@ -1957,7 +1957,7 @@ static inline int rtnetlink_fill_iwinfo(struct sk_buff * skb,

nlmsg_failure:
rtattr_failure:
	skb_trim(skb, b - skb->data);
	nlmsg_trim(skb, b);
	return -1;
}

+2 −1
Original line number Diff line number Diff line
@@ -77,6 +77,7 @@
#include <linux/rcupdate.h>
#include <linux/times.h>
#include <asm/errno.h>
#include <net/netlink.h>
#include <net/neighbour.h>
#include <net/dst.h>
#include <net/flow.h>
@@ -1514,7 +1515,7 @@ static int dn_rt_fill_info(struct sk_buff *skb, u32 pid, u32 seq,

nlmsg_failure:
rtattr_failure:
	skb_trim(skb, b - skb->data);
	nlmsg_trim(skb, b);
	return -1;
}

+2 −1
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@
#include <asm/uaccess.h>
#include <linux/route.h> /* RTF_xxx */
#include <net/neighbour.h>
#include <net/netlink.h>
#include <net/dst.h>
#include <net/flow.h>
#include <net/fib_rules.h>
@@ -349,7 +350,7 @@ static int dn_fib_dump_info(struct sk_buff *skb, u32 pid, u32 seq, int event,

nlmsg_failure:
rtattr_failure:
	skb_trim(skb, b - skb->data);
	nlmsg_trim(skb, b);
	return -EMSGSIZE;
}

+4 −3
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@
#include <net/inet_hashtables.h>
#include <net/inet_timewait_sock.h>
#include <net/inet6_hashtables.h>
#include <net/netlink.h>

#include <linux/inet.h>
#include <linux/stddef.h>
@@ -152,7 +153,7 @@ static int inet_csk_diag_fill(struct sock *sk,

rtattr_failure:
nlmsg_failure:
	skb_trim(skb, b - skb->data);
	nlmsg_trim(skb, b);
	return -EMSGSIZE;
}

@@ -208,7 +209,7 @@ static int inet_twsk_diag_fill(struct inet_timewait_sock *tw,
	nlh->nlmsg_len = skb_tail_pointer(skb) - previous_tail;
	return skb->len;
nlmsg_failure:
	skb_trim(skb, previous_tail - skb->data);
	nlmsg_trim(skb, previous_tail);
	return -EMSGSIZE;
}

@@ -579,7 +580,7 @@ static int inet_diag_fill_req(struct sk_buff *skb, struct sock *sk,
	return skb->len;

nlmsg_failure:
	skb_trim(skb, b - skb->data);
	nlmsg_trim(skb, b);
	return -1;
}

Loading