Skip to content

Commit

Permalink
NFC: digital: NFC-A SEL_RES must be one byte
Browse files Browse the repository at this point in the history
Section 4.8.2 (SEL_RES Response) of NFC Forum's NFC Digital Protocol
Technical Specification dated 2010-11-17 clearly states that the size
of a SEL_RES Response is one byte.  Enforce this restriction in the
code.

Signed-off-by: Mark Greer <[email protected]>
Signed-off-by: Samuel Ortiz <[email protected]>
  • Loading branch information
mgreeraz authored and Samuel Ortiz committed Jun 22, 2017
1 parent dcfca27 commit 7f9f171
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion net/nfc/digital_technology.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

#define DIGITAL_SDD_RES_CT 0x88
#define DIGITAL_SDD_RES_LEN 5
#define DIGITAL_SEL_RES_LEN 1

#define DIGITAL_SEL_RES_NFCID1_COMPLETE(sel_res) (!((sel_res) & 0x04))
#define DIGITAL_SEL_RES_IS_T2T(sel_res) (!((sel_res) & 0x60))
Expand Down Expand Up @@ -299,7 +300,7 @@ static void digital_in_recv_sel_res(struct nfc_digital_dev *ddev, void *arg,
}
}

if (!resp->len) {
if (resp->len != DIGITAL_SEL_RES_LEN) {
rc = -EIO;
goto exit;
}
Expand Down

0 comments on commit 7f9f171

Please sign in to comment.