summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/core/skbuff.c9
-rw-r--r--net/ieee80211/ieee80211_crypt_tkip.c11
-rw-r--r--net/ieee80211/ieee80211_crypt_wep.c2
-rw-r--r--net/sctp/auth.c4
-rw-r--r--net/sctp/sm_make_chunk.c8
-rw-r--r--net/sunrpc/auth_gss/gss_krb5_crypto.c14
-rw-r--r--net/sunrpc/xdr.c4
-rw-r--r--net/xfrm/xfrm_algo.c9
8 files changed, 20 insertions, 41 deletions
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 4e2c84fcf27..7b7c6c44c2d 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -2045,9 +2045,7 @@ skb_to_sgvec(struct sk_buff *skb, struct scatterlist *sg, int offset, int len)
if (copy > 0) {
if (copy > len)
copy = len;
- sg_set_page(&sg[elt], virt_to_page(skb->data + offset));
- sg[elt].offset = (unsigned long)(skb->data + offset) % PAGE_SIZE;
- sg[elt].length = copy;
+ sg_set_buf(sg, skb->data + offset, copy);
elt++;
if ((len -= copy) == 0)
return elt;
@@ -2065,9 +2063,8 @@ skb_to_sgvec(struct sk_buff *skb, struct scatterlist *sg, int offset, int len)
if (copy > len)
copy = len;
- sg_set_page(&sg[elt], frag->page);
- sg[elt].offset = frag->page_offset+offset-start;
- sg[elt].length = copy;
+ sg_set_page(&sg[elt], frag->page, copy,
+ frag->page_offset+offset-start);
elt++;
if (!(len -= copy))
return elt;
diff --git a/net/ieee80211/ieee80211_crypt_tkip.c b/net/ieee80211/ieee80211_crypt_tkip.c
index 811777682e2..4cce3534e40 100644
--- a/net/ieee80211/ieee80211_crypt_tkip.c
+++ b/net/ieee80211/ieee80211_crypt_tkip.c
@@ -25,7 +25,7 @@
#include <net/ieee80211.h>
#include <linux/crypto.h>
-#include <asm/scatterlist.h>
+#include <linux/scatterlist.h>
#include <linux/crc32.h>
MODULE_AUTHOR("Jouni Malinen");
@@ -537,13 +537,8 @@ static int michael_mic(struct crypto_hash *tfm_michael, u8 * key, u8 * hdr,
return -1;
}
sg_init_table(sg, 2);
- sg_set_page(&sg[0], virt_to_page(hdr));
- sg[0].offset = offset_in_page(hdr);
- sg[0].length = 16;
-
- sg_set_page(&sg[1], virt_to_page(data));
- sg[1].offset = offset_in_page(data);
- sg[1].length = data_len;
+ sg_set_buf(&sg[0], hdr, 16);
+ sg_set_buf(&sg[1], data, data_len);
if (crypto_hash_setkey(tfm_michael, key, 8))
return -1;
diff --git a/net/ieee80211/ieee80211_crypt_wep.c b/net/ieee80211/ieee80211_crypt_wep.c
index 9693429489e..866fc04c44f 100644
--- a/net/ieee80211/ieee80211_crypt_wep.c
+++ b/net/ieee80211/ieee80211_crypt_wep.c
@@ -22,7 +22,7 @@
#include <net/ieee80211.h>
#include <linux/crypto.h>
-#include <asm/scatterlist.h>
+#include <linux/scatterlist.h>
#include <linux/crc32.h>
MODULE_AUTHOR("Jouni Malinen");
diff --git a/net/sctp/auth.c b/net/sctp/auth.c
index cbd64b216cc..621113a109b 100644
--- a/net/sctp/auth.c
+++ b/net/sctp/auth.c
@@ -727,9 +727,7 @@ void sctp_auth_calculate_hmac(const struct sctp_association *asoc,
/* set up scatter list */
end = skb_tail_pointer(skb);
sg_init_table(&sg, 1);
- sg_set_page(&sg, virt_to_page(auth));
- sg.offset = (unsigned long)(auth) % PAGE_SIZE;
- sg.length = end - (unsigned char *)auth;
+ sg_set_buf(&sg, auth, end - (unsigned char *)auth);
desc.tfm = asoc->ep->auth_hmacs[hmac_id];
desc.flags = 0;
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index 658476c4d58..c055212875f 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -1514,9 +1514,7 @@ static sctp_cookie_param_t *sctp_pack_cookie(const struct sctp_endpoint *ep,
/* Sign the message. */
sg_init_table(&sg, 1);
- sg_set_page(&sg, virt_to_page(&cookie->c));
- sg.offset = (unsigned long)(&cookie->c) % PAGE_SIZE;
- sg.length = bodysize;
+ sg_set_buf(&sg, &cookie->c, bodysize);
keylen = SCTP_SECRET_SIZE;
key = (char *)ep->secret_key[ep->current_key];
desc.tfm = sctp_sk(ep->base.sk)->hmac;
@@ -1587,9 +1585,7 @@ struct sctp_association *sctp_unpack_cookie(
/* Check the signature. */
keylen = SCTP_SECRET_SIZE;
sg_init_table(&sg, 1);
- sg_set_page(&sg, virt_to_page(bear_cookie));
- sg.offset = (unsigned long)(bear_cookie) % PAGE_SIZE;
- sg.length = bodysize;
+ sg_set_buf(&sg, bear_cookie, bodysize);
key = (char *)ep->secret_key[ep->current_key];
desc.tfm = sctp_sk(ep->base.sk)->hmac;
desc.flags = 0;
diff --git a/net/sunrpc/auth_gss/gss_krb5_crypto.c b/net/sunrpc/auth_gss/gss_krb5_crypto.c
index 32be431affc..24711be4b2d 100644
--- a/net/sunrpc/auth_gss/gss_krb5_crypto.c
+++ b/net/sunrpc/auth_gss/gss_krb5_crypto.c
@@ -199,7 +199,7 @@ encryptor(struct scatterlist *sg, void *data)
} else {
in_page = sg_page(sg);
}
- sg_set_page(&desc->infrags[desc->fragno], in_page);
+ sg_assign_page(&desc->infrags[desc->fragno], in_page);
desc->fragno++;
desc->fraglen += sg->length;
desc->pos += sg->length;
@@ -215,11 +215,10 @@ encryptor(struct scatterlist *sg, void *data)
if (ret)
return ret;
if (fraglen) {
- sg_set_page(&desc->outfrags[0], sg_page(sg));
- desc->outfrags[0].offset = sg->offset + sg->length - fraglen;
- desc->outfrags[0].length = fraglen;
+ sg_set_page(&desc->outfrags[0], sg_page(sg), fraglen,
+ sg->offset + sg->length - fraglen);
desc->infrags[0] = desc->outfrags[0];
- sg_set_page(&desc->infrags[0], in_page);
+ sg_assign_page(&desc->infrags[0], in_page);
desc->fragno = 1;
desc->fraglen = fraglen;
} else {
@@ -287,9 +286,8 @@ decryptor(struct scatterlist *sg, void *data)
if (ret)
return ret;
if (fraglen) {
- sg_set_page(&desc->frags[0], sg_page(sg));
- desc->frags[0].offset = sg->offset + sg->length - fraglen;
- desc->frags[0].length = fraglen;
+ sg_set_page(&desc->frags[0], sg_page(sg), fraglen,
+ sg->offset + sg->length - fraglen);
desc->fragno = 1;
desc->fraglen = fraglen;
} else {
diff --git a/net/sunrpc/xdr.c b/net/sunrpc/xdr.c
index 3d1f7cdf9dd..f38dac30481 100644
--- a/net/sunrpc/xdr.c
+++ b/net/sunrpc/xdr.c
@@ -1059,9 +1059,7 @@ xdr_process_buf(struct xdr_buf *buf, unsigned int offset, unsigned int len,
do {
if (thislen > page_len)
thislen = page_len;
- sg_set_page(sg, buf->pages[i]);
- sg->offset = page_offset;
- sg->length = thislen;
+ sg_set_page(sg, buf->pages[i], thislen, page_offset);
ret = actor(sg, data);
if (ret)
goto out;
diff --git a/net/xfrm/xfrm_algo.c b/net/xfrm/xfrm_algo.c
index 313d4bed3aa..fa45989a716 100644
--- a/net/xfrm/xfrm_algo.c
+++ b/net/xfrm/xfrm_algo.c
@@ -553,9 +553,7 @@ int skb_icv_walk(const struct sk_buff *skb, struct hash_desc *desc,
if (copy > len)
copy = len;
- sg_set_page(&sg, virt_to_page(skb->data + offset));
- sg.offset = (unsigned long)(skb->data + offset) % PAGE_SIZE;
- sg.length = copy;
+ sg_set_buf(&sg, skb->data + offset, copy);
err = icv_update(desc, &sg, copy);
if (unlikely(err))
@@ -578,9 +576,8 @@ int skb_icv_walk(const struct sk_buff *skb, struct hash_desc *desc,
if (copy > len)
copy = len;
- sg_set_page(&sg, frag->page);
- sg.offset = frag->page_offset + offset-start;
- sg.length = copy;
+ sg_set_page(&sg, frag->page, copy,
+ frag->page_offset + offset-start);
err = icv_update(desc, &sg, copy);
if (unlikely(err))