Skip to content

Commit

Permalink
NFC: st21nfca: fix st21nfca_get_iso14443_3_uid data copy
Browse files Browse the repository at this point in the history
st21nfca_get_iso14443_3_uid() does not correctly copy the uid from
uid_skb->data to its gate parameter. "gate = uid_skb->data;" only
puts a pointer to uid_skb->data to the local variable gate.
This means that in st21nfca_hci_target_from_gate() the content
of "u8 uid[NFC_NFCID1_MAXSIZE]" local variable is never initialized
before being used in memcpy(target->nfcid1, uid, len).

Fix this by replacing the local variable assignment with a memcpy.

This was found by compiling Linux with
"gcc -Wunused-but-set-parameter".

Acked-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
  • Loading branch information
Christophe Ricard authored and Samuel Ortiz committed Apr 5, 2015
1 parent d4a41d1 commit 9906a88
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/nfc/st21nfca/st21nfca.c
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ static int st21nfca_get_iso14443_3_uid(struct nfc_hci_dev *hdev, u8 *gate,
goto exit;
}

gate = uid_skb->data;
memcpy(gate, uid_skb->data, uid_skb->len);
*len = uid_skb->len;
exit:
kfree_skb(uid_skb);
Expand Down

0 comments on commit 9906a88

Please sign in to comment.