diff options
author | Samuel Ortiz <sameo@linux.intel.com> | 2013-03-20 11:06:12 -0400 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2013-04-11 10:28:56 -0400 |
commit | 5eef6669759f8e291ab0347894876b532c242324 (patch) | |
tree | 54939e3efa7511cfcde7300dee9e1adb5c122525 /net/nfc/llcp/sock.c | |
parent | e279f84f304d5486291a2d6465105dc6f96cc8ca (diff) |
NFC: llcp: Socket miux is a big endian field
The MIUX must be transmitted in big endian and as such we have to convert
it properly.
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'net/nfc/llcp/sock.c')
-rw-r--r-- | net/nfc/llcp/sock.c | 7 |
1 files changed, 4 insertions, 3 deletions
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; |