net: ppp: use {get,put}_unaligned_be{16,32}
Signed-off-by: Changli Gao <xiaosuo@gmail.com> Reviewed-by: Harvey Harrison <harvey.harrison@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
d7b92affba
commit
96545aeb7b
@ -32,6 +32,7 @@
|
||||
#include <linux/init.h>
|
||||
#include <linux/jiffies.h>
|
||||
#include <linux/slab.h>
|
||||
#include <asm/unaligned.h>
|
||||
#include <asm/uaccess.h>
|
||||
#include <asm/string.h>
|
||||
|
||||
@ -542,7 +543,7 @@ ppp_async_encode(struct asyncppp *ap)
|
||||
data = ap->tpkt->data;
|
||||
count = ap->tpkt->len;
|
||||
fcs = ap->tfcs;
|
||||
proto = (data[0] << 8) + data[1];
|
||||
proto = get_unaligned_be16(data);
|
||||
|
||||
/*
|
||||
* LCP packets with code values between 1 (configure-reqest)
|
||||
@ -963,7 +964,7 @@ static void async_lcp_peek(struct asyncppp *ap, unsigned char *data,
|
||||
code = data[0];
|
||||
if (code != CONFACK && code != CONFREQ)
|
||||
return;
|
||||
dlen = (data[2] << 8) + data[3];
|
||||
dlen = get_unaligned_be16(data + 2);
|
||||
if (len < dlen)
|
||||
return; /* packet got truncated or length is bogus */
|
||||
|
||||
@ -997,15 +998,14 @@ static void async_lcp_peek(struct asyncppp *ap, unsigned char *data,
|
||||
while (dlen >= 2 && dlen >= data[1] && data[1] >= 2) {
|
||||
switch (data[0]) {
|
||||
case LCP_MRU:
|
||||
val = (data[2] << 8) + data[3];
|
||||
val = get_unaligned_be16(data + 2);
|
||||
if (inbound)
|
||||
ap->mru = val;
|
||||
else
|
||||
ap->chan.mtu = val;
|
||||
break;
|
||||
case LCP_ASYNCMAP:
|
||||
val = (data[2] << 24) + (data[3] << 16)
|
||||
+ (data[4] << 8) + data[5];
|
||||
val = get_unaligned_be32(data + 2);
|
||||
if (inbound)
|
||||
ap->raccm = val;
|
||||
else
|
||||
|
Reference in New Issue
Block a user