diff options
author | Julien Lefrique <lefrique@marvell.com> | 2014-12-02 10:25:01 -0500 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2014-12-02 16:59:28 -0500 |
commit | e479ce479743984a5d4581749f9aaa9c3bfd65e4 (patch) | |
tree | 54374cdfad53b82596bc835685639ff049b0db77 /net/nfc/nci | |
parent | 3ff24012dd28d2b86cea691599a85723d6c19e87 (diff) |
NFC: NCI: Fix max length of General Bytes in ATR_RES
The maximum size of ATR_REQ and ATR_RES is 64 bytes.
The maximum number of General Bytes is calculated by
the maximum number of data bytes in the ATR_REQ/ATR_RES,
substracted by the number of mandatory data bytes.
ATR_REQ: 16 mandatory data bytes, giving a maximum of
48 General Bytes.
ATR_RES: 17 mandatory data bytes, giving a maximum of
47 General Bytes.
Regression introduced in commit a99903ec.
Signed-off-by: Julien Lefrique <lefrique@marvell.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'net/nfc/nci')
-rw-r--r-- | net/nfc/nci/ntf.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/net/nfc/nci/ntf.c b/net/nfc/nci/ntf.c index 8dee73d0c4e1..22e453cb787d 100644 --- a/net/nfc/nci/ntf.c +++ b/net/nfc/nci/ntf.c | |||
@@ -479,24 +479,22 @@ static int nci_store_general_bytes_nfc_dep(struct nci_dev *ndev, | |||
479 | switch (ntf->activation_rf_tech_and_mode) { | 479 | switch (ntf->activation_rf_tech_and_mode) { |
480 | case NCI_NFC_A_PASSIVE_POLL_MODE: | 480 | case NCI_NFC_A_PASSIVE_POLL_MODE: |
481 | case NCI_NFC_F_PASSIVE_POLL_MODE: | 481 | case NCI_NFC_F_PASSIVE_POLL_MODE: |
482 | /* ATR_RES general bytes at offset 15 */ | ||
483 | ndev->remote_gb_len = min_t(__u8, | 482 | ndev->remote_gb_len = min_t(__u8, |
484 | (ntf->activation_params.poll_nfc_dep.atr_res_len | 483 | (ntf->activation_params.poll_nfc_dep.atr_res_len |
485 | - NFC_ATR_RES_GT_OFFSET), | 484 | - NFC_ATR_RES_GT_OFFSET), |
486 | NFC_MAX_GT_LEN); | 485 | NFC_ATR_RES_GB_MAXSIZE); |
487 | memcpy(ndev->remote_gb, | 486 | memcpy(ndev->remote_gb, |
488 | (ntf->activation_params.poll_nfc_dep .atr_res | 487 | (ntf->activation_params.poll_nfc_dep.atr_res |
489 | + NFC_ATR_RES_GT_OFFSET), | 488 | + NFC_ATR_RES_GT_OFFSET), |
490 | ndev->remote_gb_len); | 489 | ndev->remote_gb_len); |
491 | break; | 490 | break; |
492 | 491 | ||
493 | case NCI_NFC_A_PASSIVE_LISTEN_MODE: | 492 | case NCI_NFC_A_PASSIVE_LISTEN_MODE: |
494 | case NCI_NFC_F_PASSIVE_LISTEN_MODE: | 493 | case NCI_NFC_F_PASSIVE_LISTEN_MODE: |
495 | /* ATR_REQ general bytes at offset 14 */ | ||
496 | ndev->remote_gb_len = min_t(__u8, | 494 | ndev->remote_gb_len = min_t(__u8, |
497 | (ntf->activation_params.listen_nfc_dep.atr_req_len | 495 | (ntf->activation_params.listen_nfc_dep.atr_req_len |
498 | - NFC_ATR_REQ_GT_OFFSET), | 496 | - NFC_ATR_REQ_GT_OFFSET), |
499 | NFC_MAX_GT_LEN); | 497 | NFC_ATR_REQ_GB_MAXSIZE); |
500 | memcpy(ndev->remote_gb, | 498 | memcpy(ndev->remote_gb, |
501 | (ntf->activation_params.listen_nfc_dep.atr_req | 499 | (ntf->activation_params.listen_nfc_dep.atr_req |
502 | + NFC_ATR_REQ_GT_OFFSET), | 500 | + NFC_ATR_REQ_GT_OFFSET), |