aboutsummaryrefslogtreecommitdiffstats
path: root/net/nfc/llcp
diff options
context:
space:
mode:
Diffstat (limited to 'net/nfc/llcp')
-rw-r--r--net/nfc/llcp/commands.c6
-rw-r--r--net/nfc/llcp/llcp.h2
-rw-r--r--net/nfc/llcp/sock.c7
3 files changed, 9 insertions, 6 deletions
diff --git a/net/nfc/llcp/commands.c b/net/nfc/llcp/commands.c
index b75a9b3f9e89..c5535cc9ed3a 100644
--- a/net/nfc/llcp/commands.c
+++ b/net/nfc/llcp/commands.c
@@ -420,7 +420,8 @@ int nfc_llcp_send_connect(struct nfc_llcp_sock *sock)
420 } 420 }
421 421
422 /* If the socket parameters are not set, use the local ones */ 422 /* If the socket parameters are not set, use the local ones */
423 miux = sock->miux > LLCP_MAX_MIUX ? local->miux : sock->miux; 423 miux = be16_to_cpu(sock->miux) > LLCP_MAX_MIUX ?
424 local->miux : sock->miux;
424 rw = sock->rw > LLCP_MAX_RW ? local->rw : sock->rw; 425 rw = sock->rw > LLCP_MAX_RW ? local->rw : sock->rw;
425 426
426 miux_tlv = nfc_llcp_build_tlv(LLCP_TLV_MIUX, (u8 *)&miux, 0, 427 miux_tlv = nfc_llcp_build_tlv(LLCP_TLV_MIUX, (u8 *)&miux, 0,
@@ -475,7 +476,8 @@ int nfc_llcp_send_cc(struct nfc_llcp_sock *sock)
475 return -ENODEV; 476 return -ENODEV;
476 477
477 /* If the socket parameters are not set, use the local ones */ 478 /* If the socket parameters are not set, use the local ones */
478 miux = sock->miux > LLCP_MAX_MIUX ? local->miux : sock->miux; 479 miux = be16_to_cpu(sock->miux) > LLCP_MAX_MIUX ?
480 local->miux : sock->miux;
479 rw = sock->rw > LLCP_MAX_RW ? local->rw : sock->rw; 481 rw = sock->rw > LLCP_MAX_RW ? local->rw : sock->rw;
480 482
481 miux_tlv = nfc_llcp_build_tlv(LLCP_TLV_MIUX, (u8 *)&miux, 0, 483 miux_tlv = nfc_llcp_build_tlv(LLCP_TLV_MIUX, (u8 *)&miux, 0,
diff --git a/net/nfc/llcp/llcp.h b/net/nfc/llcp/llcp.h
index 7e87a66b02ec..53054d337bf9 100644
--- a/net/nfc/llcp/llcp.h
+++ b/net/nfc/llcp/llcp.h
@@ -124,7 +124,7 @@ struct nfc_llcp_sock {
124 char *service_name; 124 char *service_name;
125 size_t service_name_len; 125 size_t service_name_len;
126 u8 rw; 126 u8 rw;
127 u16 miux; 127 __be16 miux;
128 128
129 129
130 /* Remote link parameters */ 130 /* Remote link parameters */
diff --git a/net/nfc/llcp/sock.c b/net/nfc/llcp/sock.c
index 6fa76704cb13..873c837e5c97 100644
--- a/net/nfc/llcp/sock.c
+++ b/net/nfc/llcp/sock.c
@@ -279,7 +279,7 @@ static int nfc_llcp_setsockopt(struct socket *sock, int level, int optname,
279 break; 279 break;
280 } 280 }
281 281
282 llcp_sock->miux = (u16) opt; 282 llcp_sock->miux = cpu_to_be16((u16) opt);
283 283
284 break; 284 break;
285 285
@@ -323,7 +323,8 @@ static int nfc_llcp_getsockopt(struct socket *sock, int level, int optname,
323 break; 323 break;
324 324
325 case NFC_LLCP_MIUX: 325 case NFC_LLCP_MIUX:
326 if (put_user(llcp_sock->miux, (u32 __user *) optval)) 326 if (put_user(be16_to_cpu(llcp_sock->miux),
327 (u32 __user *) optval))
327 err = -EFAULT; 328 err = -EFAULT;
328 329
329 break; 330 break;
@@ -921,7 +922,7 @@ struct sock *nfc_llcp_sock_alloc(struct socket *sock, int type, gfp_t gfp)
921 llcp_sock->ssap = 0; 922 llcp_sock->ssap = 0;
922 llcp_sock->dsap = LLCP_SAP_SDP; 923 llcp_sock->dsap = LLCP_SAP_SDP;
923 llcp_sock->rw = LLCP_MAX_RW + 1; 924 llcp_sock->rw = LLCP_MAX_RW + 1;
924 llcp_sock->miux = LLCP_MAX_MIUX + 1; 925 llcp_sock->miux = cpu_to_be16(LLCP_MAX_MIUX + 1);
925 llcp_sock->remote_rw = LLCP_DEFAULT_RW; 926 llcp_sock->remote_rw = LLCP_DEFAULT_RW;
926 llcp_sock->remote_miu = LLCP_DEFAULT_MIU; 927 llcp_sock->remote_miu = LLCP_DEFAULT_MIU;
927 llcp_sock->send_n = llcp_sock->send_ack_n = 0; 928 llcp_sock->send_n = llcp_sock->send_ack_n = 0;