1
0
Fork 0

NFC: st21nfca: Fix incorrect byte stuffing revocation

Byte stuffing was not correctly removed after a i2c read operation.
This was causing improper crc calculation when byte stuffing was
applied to more than 1 byte.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
hifive-unleashed-5.1
Christophe Ricard 2014-04-24 23:19:32 +02:00 committed by Samuel Ortiz
parent 0bb8a622d6
commit 3096e25a3e
1 changed files with 3 additions and 4 deletions

View File

@ -315,11 +315,10 @@ static int st21nfca_hci_i2c_repack(struct sk_buff *skb)
skb_trim(skb, size);
/* remove ST21NFCA byte stuffing for upper layer */
for (i = 1, j = 0; i < skb->len; i++) {
if (skb->data[i] ==
if (skb->data[i + j] ==
(u8) ST21NFCA_ESCAPE_BYTE_STUFFING) {
skb->data[i] =
skb->data[i +
1] | ST21NFCA_BYTE_STUFFING_MASK;
skb->data[i] = skb->data[i + j + 1]
| ST21NFCA_BYTE_STUFFING_MASK;
i++;
j++;
}