Commit fad2e371 authored by Samuel Ortiz's avatar Samuel Ortiz

NFC: Avoid memcpy on LLCP connection less Rx path

We can cast msg_name to a sockaddr_nfc_llcp pointer directly.
Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
parent 1353a10c
...@@ -682,17 +682,17 @@ static int llcp_sock_recvmsg(struct kiocb *iocb, struct socket *sock, ...@@ -682,17 +682,17 @@ static int llcp_sock_recvmsg(struct kiocb *iocb, struct socket *sock,
if (sk->sk_type == SOCK_DGRAM && msg->msg_name) { if (sk->sk_type == SOCK_DGRAM && msg->msg_name) {
struct nfc_llcp_ui_cb *ui_cb = nfc_llcp_ui_skb_cb(skb); struct nfc_llcp_ui_cb *ui_cb = nfc_llcp_ui_skb_cb(skb);
struct sockaddr_nfc_llcp sockaddr; struct sockaddr_nfc_llcp *sockaddr =
(struct sockaddr_nfc_llcp *) msg->msg_name;
pr_debug("Datagram socket %d %d\n", ui_cb->dsap, ui_cb->ssap); msg->msg_namelen = sizeof(struct sockaddr_nfc_llcp);
sockaddr.sa_family = AF_NFC; pr_debug("Datagram socket %d %d\n", ui_cb->dsap, ui_cb->ssap);
sockaddr.nfc_protocol = NFC_PROTO_NFC_DEP;
sockaddr.dsap = ui_cb->dsap;
sockaddr.ssap = ui_cb->ssap;
memcpy(msg->msg_name, &sockaddr, sizeof(sockaddr)); sockaddr->sa_family = AF_NFC;
msg->msg_namelen = sizeof(sockaddr); sockaddr->nfc_protocol = NFC_PROTO_NFC_DEP;
sockaddr->dsap = ui_cb->dsap;
sockaddr->ssap = ui_cb->ssap;
} }
/* Mark read part of skb as used */ /* Mark read part of skb as used */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment