Skip to content

Commit

Permalink
nfc: st21nfcb: Add additional comments about EVT_TRANSACTION
Browse files Browse the repository at this point in the history
Add comments about HCI EVT_TRANSACTION in order to make the code
understandable by other readers.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
  • Loading branch information
Christophe Ricard authored and Samuel Ortiz committed Apr 5, 2015
1 parent 1f74f32 commit 1dab57f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion drivers/nfc/st21nfcb/st21nfcb_se.c
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,12 @@ static int st21nfcb_hci_connectivity_event_received(struct nci_dev *ndev,

break;
case ST21NFCB_EVT_TRANSACTION:
/* According to specification etsi 102 622
* 11.2.2.4 EVT_TRANSACTION Table 52
* Description Tag Length
* AID 81 5 to 16
* PARAMETERS 82 0 to 255
*/
if (skb->len < NFC_MIN_AID_LENGTH + 2 &&
skb->data[0] != NFC_EVT_TRANSACTION_AID_TAG)
return -EPROTO;
Expand All @@ -329,8 +335,9 @@ static int st21nfcb_hci_connectivity_event_received(struct nci_dev *ndev,
skb->len - 2, GFP_KERNEL);

transaction->aid_len = skb->data[1];
memcpy(transaction->aid, &skb->data[2], skb->data[1]);
memcpy(transaction->aid, &skb->data[2], transaction->aid_len);

/* Check next byte is PARAMETERS tag (82) */
if (skb->data[transaction->aid_len + 2] !=
NFC_EVT_TRANSACTION_PARAMS_TAG)
return -EPROTO;
Expand Down

0 comments on commit 1dab57f

Please sign in to comment.