Commit eeeb0374 authored by Arnaldo Carvalho de Melo's avatar Arnaldo Carvalho de Melo Committed by David S. Miller

[SK_BUFF]: More skb_put related conversions to skb_reset_transport_header

This is similar to the skb_reset_network_header(), i.e. at the point we reset
the transport header pointer/offset skb->tail is equal to skb->data.
Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ac6d141d
...@@ -1274,7 +1274,6 @@ static int irda_sendmsg(struct kiocb *iocb, struct socket *sock, ...@@ -1274,7 +1274,6 @@ static int irda_sendmsg(struct kiocb *iocb, struct socket *sock,
struct sock *sk = sock->sk; struct sock *sk = sock->sk;
struct irda_sock *self; struct irda_sock *self;
struct sk_buff *skb; struct sk_buff *skb;
unsigned char *asmptr;
int err; int err;
IRDA_DEBUG(4, "%s(), len=%zd\n", __FUNCTION__, len); IRDA_DEBUG(4, "%s(), len=%zd\n", __FUNCTION__, len);
...@@ -1317,9 +1316,9 @@ static int irda_sendmsg(struct kiocb *iocb, struct socket *sock, ...@@ -1317,9 +1316,9 @@ static int irda_sendmsg(struct kiocb *iocb, struct socket *sock,
return -ENOBUFS; return -ENOBUFS;
skb_reserve(skb, self->max_header_size + 16); skb_reserve(skb, self->max_header_size + 16);
skb_reset_transport_header(skb);
asmptr = skb->h.raw = skb_put(skb, len); skb_put(skb, len);
err = memcpy_fromiovec(asmptr, msg->msg_iov, len); err = memcpy_fromiovec(skb_transport_header(skb), msg->msg_iov, len);
if (err) { if (err) {
kfree_skb(skb); kfree_skb(skb);
return err; return err;
...@@ -1530,7 +1529,6 @@ static int irda_sendmsg_dgram(struct kiocb *iocb, struct socket *sock, ...@@ -1530,7 +1529,6 @@ static int irda_sendmsg_dgram(struct kiocb *iocb, struct socket *sock,
struct sock *sk = sock->sk; struct sock *sk = sock->sk;
struct irda_sock *self; struct irda_sock *self;
struct sk_buff *skb; struct sk_buff *skb;
unsigned char *asmptr;
int err; int err;
IRDA_DEBUG(4, "%s(), len=%zd\n", __FUNCTION__, len); IRDA_DEBUG(4, "%s(), len=%zd\n", __FUNCTION__, len);
...@@ -1566,10 +1564,11 @@ static int irda_sendmsg_dgram(struct kiocb *iocb, struct socket *sock, ...@@ -1566,10 +1564,11 @@ static int irda_sendmsg_dgram(struct kiocb *iocb, struct socket *sock,
return -ENOBUFS; return -ENOBUFS;
skb_reserve(skb, self->max_header_size); skb_reserve(skb, self->max_header_size);
skb_reset_transport_header(skb);
IRDA_DEBUG(4, "%s(), appending user data\n", __FUNCTION__); IRDA_DEBUG(4, "%s(), appending user data\n", __FUNCTION__);
asmptr = skb->h.raw = skb_put(skb, len); skb_put(skb, len);
err = memcpy_fromiovec(asmptr, msg->msg_iov, len); err = memcpy_fromiovec(skb_transport_header(skb), msg->msg_iov, len);
if (err) { if (err) {
kfree_skb(skb); kfree_skb(skb);
return err; return err;
...@@ -1602,7 +1601,6 @@ static int irda_sendmsg_ultra(struct kiocb *iocb, struct socket *sock, ...@@ -1602,7 +1601,6 @@ static int irda_sendmsg_ultra(struct kiocb *iocb, struct socket *sock,
__u8 pid = 0; __u8 pid = 0;
int bound = 0; int bound = 0;
struct sk_buff *skb; struct sk_buff *skb;
unsigned char *asmptr;
int err; int err;
IRDA_DEBUG(4, "%s(), len=%zd\n", __FUNCTION__, len); IRDA_DEBUG(4, "%s(), len=%zd\n", __FUNCTION__, len);
...@@ -1662,10 +1660,11 @@ static int irda_sendmsg_ultra(struct kiocb *iocb, struct socket *sock, ...@@ -1662,10 +1660,11 @@ static int irda_sendmsg_ultra(struct kiocb *iocb, struct socket *sock,
return -ENOBUFS; return -ENOBUFS;
skb_reserve(skb, self->max_header_size); skb_reserve(skb, self->max_header_size);
skb_reset_transport_header(skb);
IRDA_DEBUG(4, "%s(), appending user data\n", __FUNCTION__); IRDA_DEBUG(4, "%s(), appending user data\n", __FUNCTION__);
asmptr = skb->h.raw = skb_put(skb, len); skb_put(skb, len);
err = memcpy_fromiovec(asmptr, msg->msg_iov, len); err = memcpy_fromiovec(skb_transport_header(skb), msg->msg_iov, len);
if (err) { if (err) {
kfree_skb(skb); kfree_skb(skb);
return err; return err;
......
...@@ -1074,6 +1074,7 @@ static int nr_sendmsg(struct kiocb *iocb, struct socket *sock, ...@@ -1074,6 +1074,7 @@ static int nr_sendmsg(struct kiocb *iocb, struct socket *sock,
goto out; goto out;
skb_reserve(skb, size - len); skb_reserve(skb, size - len);
skb_reset_transport_header(skb);
/* /*
* Push down the NET/ROM header * Push down the NET/ROM header
...@@ -1094,14 +1095,12 @@ static int nr_sendmsg(struct kiocb *iocb, struct socket *sock, ...@@ -1094,14 +1095,12 @@ static int nr_sendmsg(struct kiocb *iocb, struct socket *sock,
/* /*
* Put the data on the end * Put the data on the end
*/ */
skb_put(skb, len);
skb->h.raw = skb_put(skb, len);
asmptr = skb->h.raw;
SOCK_DEBUG(sk, "NET/ROM: Appending user data\n"); SOCK_DEBUG(sk, "NET/ROM: Appending user data\n");
/* User data follows immediately after the NET/ROM transport header */ /* User data follows immediately after the NET/ROM transport header */
if (memcpy_fromiovec(asmptr, msg->msg_iov, len)) { if (memcpy_fromiovec(skb_transport_header(skb), msg->msg_iov, len)) {
kfree_skb(skb); kfree_skb(skb);
err = -EFAULT; err = -EFAULT;
goto out; goto out;
......
...@@ -1105,9 +1105,10 @@ static int rose_sendmsg(struct kiocb *iocb, struct socket *sock, ...@@ -1105,9 +1105,10 @@ static int rose_sendmsg(struct kiocb *iocb, struct socket *sock,
*/ */
SOCK_DEBUG(sk, "ROSE: Appending user data\n"); SOCK_DEBUG(sk, "ROSE: Appending user data\n");
asmptr = skb->h.raw = skb_put(skb, len); skb_reset_transport_header(skb);
skb_put(skb, len);
err = memcpy_fromiovec(asmptr, msg->msg_iov, len); err = memcpy_fromiovec(skb_transport_header(skb), msg->msg_iov, len);
if (err) { if (err) {
kfree_skb(skb); kfree_skb(skb);
return err; return err;
......
...@@ -1058,9 +1058,10 @@ static int x25_sendmsg(struct kiocb *iocb, struct socket *sock, ...@@ -1058,9 +1058,10 @@ static int x25_sendmsg(struct kiocb *iocb, struct socket *sock,
*/ */
SOCK_DEBUG(sk, "x25_sendmsg: Copying user data\n"); SOCK_DEBUG(sk, "x25_sendmsg: Copying user data\n");
asmptr = skb->h.raw = skb_put(skb, len); skb_reset_transport_header(skb);
skb_put(skb, len);
rc = memcpy_fromiovec(asmptr, msg->msg_iov, len); rc = memcpy_fromiovec(skb_transport_header(skb), msg->msg_iov, len);
if (rc) if (rc)
goto out_kfree_skb; goto out_kfree_skb;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment