diff options
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/ppp_async.c | 10 | ||||
-rw-r--r-- | drivers/net/ppp_deflate.c | 9 | ||||
-rw-r--r-- | drivers/net/ppp_generic.c | 9 | ||||
-rw-r--r-- | drivers/net/ppp_mppe.c | 7 | ||||
-rw-r--r-- | drivers/net/ppp_synctty.c | 3 |
5 files changed, 18 insertions, 20 deletions
diff --git a/drivers/net/ppp_async.c b/drivers/net/ppp_async.c index 78d70a6481bf..a1b82c9c67d2 100644 --- a/drivers/net/ppp_async.c +++ b/drivers/net/ppp_async.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/init.h> | 32 | #include <linux/init.h> |
33 | #include <linux/jiffies.h> | 33 | #include <linux/jiffies.h> |
34 | #include <linux/slab.h> | 34 | #include <linux/slab.h> |
35 | #include <asm/unaligned.h> | ||
35 | #include <asm/uaccess.h> | 36 | #include <asm/uaccess.h> |
36 | #include <asm/string.h> | 37 | #include <asm/string.h> |
37 | 38 | ||
@@ -542,7 +543,7 @@ ppp_async_encode(struct asyncppp *ap) | |||
542 | data = ap->tpkt->data; | 543 | data = ap->tpkt->data; |
543 | count = ap->tpkt->len; | 544 | count = ap->tpkt->len; |
544 | fcs = ap->tfcs; | 545 | fcs = ap->tfcs; |
545 | proto = (data[0] << 8) + data[1]; | 546 | proto = get_unaligned_be16(data); |
546 | 547 | ||
547 | /* | 548 | /* |
548 | * LCP packets with code values between 1 (configure-reqest) | 549 | * LCP packets with code values between 1 (configure-reqest) |
@@ -963,7 +964,7 @@ static void async_lcp_peek(struct asyncppp *ap, unsigned char *data, | |||
963 | code = data[0]; | 964 | code = data[0]; |
964 | if (code != CONFACK && code != CONFREQ) | 965 | if (code != CONFACK && code != CONFREQ) |
965 | return; | 966 | return; |
966 | dlen = (data[2] << 8) + data[3]; | 967 | dlen = get_unaligned_be16(data + 2); |
967 | if (len < dlen) | 968 | if (len < dlen) |
968 | return; /* packet got truncated or length is bogus */ | 969 | return; /* packet got truncated or length is bogus */ |
969 | 970 | ||
@@ -997,15 +998,14 @@ static void async_lcp_peek(struct asyncppp *ap, unsigned char *data, | |||
997 | while (dlen >= 2 && dlen >= data[1] && data[1] >= 2) { | 998 | while (dlen >= 2 && dlen >= data[1] && data[1] >= 2) { |
998 | switch (data[0]) { | 999 | switch (data[0]) { |
999 | case LCP_MRU: | 1000 | case LCP_MRU: |
1000 | val = (data[2] << 8) + data[3]; | 1001 | val = get_unaligned_be16(data + 2); |
1001 | if (inbound) | 1002 | if (inbound) |
1002 | ap->mru = val; | 1003 | ap->mru = val; |
1003 | else | 1004 | else |
1004 | ap->chan.mtu = val; | 1005 | ap->chan.mtu = val; |
1005 | break; | 1006 | break; |
1006 | case LCP_ASYNCMAP: | 1007 | case LCP_ASYNCMAP: |
1007 | val = (data[2] << 24) + (data[3] << 16) | 1008 | val = get_unaligned_be32(data + 2); |
1008 | + (data[4] << 8) + data[5]; | ||
1009 | if (inbound) | 1009 | if (inbound) |
1010 | ap->raccm = val; | 1010 | ap->raccm = val; |
1011 | else | 1011 | else |
diff --git a/drivers/net/ppp_deflate.c b/drivers/net/ppp_deflate.c index 695bc83e0cfd..43583309a65d 100644 --- a/drivers/net/ppp_deflate.c +++ b/drivers/net/ppp_deflate.c | |||
@@ -41,6 +41,7 @@ | |||
41 | #include <linux/ppp-comp.h> | 41 | #include <linux/ppp-comp.h> |
42 | 42 | ||
43 | #include <linux/zlib.h> | 43 | #include <linux/zlib.h> |
44 | #include <asm/unaligned.h> | ||
44 | 45 | ||
45 | /* | 46 | /* |
46 | * State for a Deflate (de)compressor. | 47 | * State for a Deflate (de)compressor. |
@@ -232,11 +233,9 @@ static int z_compress(void *arg, unsigned char *rptr, unsigned char *obuf, | |||
232 | */ | 233 | */ |
233 | wptr[0] = PPP_ADDRESS(rptr); | 234 | wptr[0] = PPP_ADDRESS(rptr); |
234 | wptr[1] = PPP_CONTROL(rptr); | 235 | wptr[1] = PPP_CONTROL(rptr); |
235 | wptr[2] = PPP_COMP >> 8; | 236 | put_unaligned_be16(PPP_COMP, wptr + 2); |
236 | wptr[3] = PPP_COMP; | ||
237 | wptr += PPP_HDRLEN; | 237 | wptr += PPP_HDRLEN; |
238 | wptr[0] = state->seqno >> 8; | 238 | put_unaligned_be16(state->seqno, wptr); |
239 | wptr[1] = state->seqno; | ||
240 | wptr += DEFLATE_OVHD; | 239 | wptr += DEFLATE_OVHD; |
241 | olen = PPP_HDRLEN + DEFLATE_OVHD; | 240 | olen = PPP_HDRLEN + DEFLATE_OVHD; |
242 | state->strm.next_out = wptr; | 241 | state->strm.next_out = wptr; |
@@ -451,7 +450,7 @@ static int z_decompress(void *arg, unsigned char *ibuf, int isize, | |||
451 | } | 450 | } |
452 | 451 | ||
453 | /* Check the sequence number. */ | 452 | /* Check the sequence number. */ |
454 | seq = (ibuf[PPP_HDRLEN] << 8) + ibuf[PPP_HDRLEN+1]; | 453 | seq = get_unaligned_be16(ibuf + PPP_HDRLEN); |
455 | if (seq != (state->seqno & 0xffff)) { | 454 | if (seq != (state->seqno & 0xffff)) { |
456 | if (state->debug) | 455 | if (state->debug) |
457 | printk(KERN_DEBUG "z_decompress%d: bad seq # %d, expected %d\n", | 456 | printk(KERN_DEBUG "z_decompress%d: bad seq # %d, expected %d\n", |
diff --git a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c index 6456484c0299..c7a6c4466978 100644 --- a/drivers/net/ppp_generic.c +++ b/drivers/net/ppp_generic.c | |||
@@ -46,6 +46,7 @@ | |||
46 | #include <linux/device.h> | 46 | #include <linux/device.h> |
47 | #include <linux/mutex.h> | 47 | #include <linux/mutex.h> |
48 | #include <linux/slab.h> | 48 | #include <linux/slab.h> |
49 | #include <asm/unaligned.h> | ||
49 | #include <net/slhc_vj.h> | 50 | #include <net/slhc_vj.h> |
50 | #include <asm/atomic.h> | 51 | #include <asm/atomic.h> |
51 | 52 | ||
@@ -210,7 +211,7 @@ struct ppp_net { | |||
210 | }; | 211 | }; |
211 | 212 | ||
212 | /* Get the PPP protocol number from a skb */ | 213 | /* Get the PPP protocol number from a skb */ |
213 | #define PPP_PROTO(skb) (((skb)->data[0] << 8) + (skb)->data[1]) | 214 | #define PPP_PROTO(skb) get_unaligned_be16((skb)->data) |
214 | 215 | ||
215 | /* We limit the length of ppp->file.rq to this (arbitrary) value */ | 216 | /* We limit the length of ppp->file.rq to this (arbitrary) value */ |
216 | #define PPP_MAX_RQLEN 32 | 217 | #define PPP_MAX_RQLEN 32 |
@@ -964,8 +965,7 @@ ppp_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
964 | 965 | ||
965 | pp = skb_push(skb, 2); | 966 | pp = skb_push(skb, 2); |
966 | proto = npindex_to_proto[npi]; | 967 | proto = npindex_to_proto[npi]; |
967 | pp[0] = proto >> 8; | 968 | put_unaligned_be16(proto, pp); |
968 | pp[1] = proto; | ||
969 | 969 | ||
970 | netif_stop_queue(dev); | 970 | netif_stop_queue(dev); |
971 | skb_queue_tail(&ppp->file.xq, skb); | 971 | skb_queue_tail(&ppp->file.xq, skb); |
@@ -1473,8 +1473,7 @@ static int ppp_mp_explode(struct ppp *ppp, struct sk_buff *skb) | |||
1473 | q = skb_put(frag, flen + hdrlen); | 1473 | q = skb_put(frag, flen + hdrlen); |
1474 | 1474 | ||
1475 | /* make the MP header */ | 1475 | /* make the MP header */ |
1476 | q[0] = PPP_MP >> 8; | 1476 | put_unaligned_be16(PPP_MP, q); |
1477 | q[1] = PPP_MP; | ||
1478 | if (ppp->flags & SC_MP_XSHORTSEQ) { | 1477 | if (ppp->flags & SC_MP_XSHORTSEQ) { |
1479 | q[2] = bits + ((ppp->nxseq >> 8) & 0xf); | 1478 | q[2] = bits + ((ppp->nxseq >> 8) & 0xf); |
1480 | q[3] = ppp->nxseq; | 1479 | q[3] = ppp->nxseq; |
diff --git a/drivers/net/ppp_mppe.c b/drivers/net/ppp_mppe.c index 6d1a1b80cc3e..9a1849a83e2a 100644 --- a/drivers/net/ppp_mppe.c +++ b/drivers/net/ppp_mppe.c | |||
@@ -55,6 +55,7 @@ | |||
55 | #include <linux/ppp_defs.h> | 55 | #include <linux/ppp_defs.h> |
56 | #include <linux/ppp-comp.h> | 56 | #include <linux/ppp-comp.h> |
57 | #include <linux/scatterlist.h> | 57 | #include <linux/scatterlist.h> |
58 | #include <asm/unaligned.h> | ||
58 | 59 | ||
59 | #include "ppp_mppe.h" | 60 | #include "ppp_mppe.h" |
60 | 61 | ||
@@ -395,16 +396,14 @@ mppe_compress(void *arg, unsigned char *ibuf, unsigned char *obuf, | |||
395 | */ | 396 | */ |
396 | obuf[0] = PPP_ADDRESS(ibuf); | 397 | obuf[0] = PPP_ADDRESS(ibuf); |
397 | obuf[1] = PPP_CONTROL(ibuf); | 398 | obuf[1] = PPP_CONTROL(ibuf); |
398 | obuf[2] = PPP_COMP >> 8; /* isize + MPPE_OVHD + 1 */ | 399 | put_unaligned_be16(PPP_COMP, obuf + 2); |
399 | obuf[3] = PPP_COMP; /* isize + MPPE_OVHD + 2 */ | ||
400 | obuf += PPP_HDRLEN; | 400 | obuf += PPP_HDRLEN; |
401 | 401 | ||
402 | state->ccount = (state->ccount + 1) % MPPE_CCOUNT_SPACE; | 402 | state->ccount = (state->ccount + 1) % MPPE_CCOUNT_SPACE; |
403 | if (state->debug >= 7) | 403 | if (state->debug >= 7) |
404 | printk(KERN_DEBUG "mppe_compress[%d]: ccount %d\n", state->unit, | 404 | printk(KERN_DEBUG "mppe_compress[%d]: ccount %d\n", state->unit, |
405 | state->ccount); | 405 | state->ccount); |
406 | obuf[0] = state->ccount >> 8; | 406 | put_unaligned_be16(state->ccount, obuf); |
407 | obuf[1] = state->ccount & 0xff; | ||
408 | 407 | ||
409 | if (!state->stateful || /* stateless mode */ | 408 | if (!state->stateful || /* stateless mode */ |
410 | ((state->ccount & 0xff) == 0xff) || /* "flag" packet */ | 409 | ((state->ccount & 0xff) == 0xff) || /* "flag" packet */ |
diff --git a/drivers/net/ppp_synctty.c b/drivers/net/ppp_synctty.c index 4c95ec3fb8d4..4e6b72f57de8 100644 --- a/drivers/net/ppp_synctty.c +++ b/drivers/net/ppp_synctty.c | |||
@@ -45,6 +45,7 @@ | |||
45 | #include <linux/completion.h> | 45 | #include <linux/completion.h> |
46 | #include <linux/init.h> | 46 | #include <linux/init.h> |
47 | #include <linux/slab.h> | 47 | #include <linux/slab.h> |
48 | #include <asm/unaligned.h> | ||
48 | #include <asm/uaccess.h> | 49 | #include <asm/uaccess.h> |
49 | 50 | ||
50 | #define PPP_VERSION "2.4.2" | 51 | #define PPP_VERSION "2.4.2" |
@@ -563,7 +564,7 @@ ppp_sync_txmunge(struct syncppp *ap, struct sk_buff *skb) | |||
563 | int islcp; | 564 | int islcp; |
564 | 565 | ||
565 | data = skb->data; | 566 | data = skb->data; |
566 | proto = (data[0] << 8) + data[1]; | 567 | proto = get_unaligned_be16(data); |
567 | 568 | ||
568 | /* LCP packets with codes between 1 (configure-request) | 569 | /* LCP packets with codes between 1 (configure-request) |
569 | * and 7 (code-reject) must be sent as though no options | 570 | * and 7 (code-reject) must be sent as though no options |