diff options
| author | Thierry Escande <thierry.escande@linux.intel.com> | 2014-01-26 18:31:14 -0500 |
|---|---|---|
| committer | Samuel Ortiz <sameo@linux.intel.com> | 2014-02-16 17:49:54 -0500 |
| commit | d3815ea95c67e62a2c651e7b5b4e08e95a4cbb13 (patch) | |
| tree | 56d9df08bb95cd680bd792c82b2a0972c8882152 | |
| parent | f1dd56fdc4b7474bfbda1753b42526dc144b55dd (diff) | |
NFC: port100: Fix possible buffer overflow
The arrays for protocols and rf techs must define a number of entries
corresponding to their maximum possible index values.
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Thierry Escande <thierry.escande@linux.intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
| -rw-r--r-- | drivers/nfc/port100.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/nfc/port100.c b/drivers/nfc/port100.c index a8555f81cbba..24f5e023f2a5 100644 --- a/drivers/nfc/port100.c +++ b/drivers/nfc/port100.c | |||
| @@ -139,6 +139,8 @@ static const struct port100_in_rf_setting in_rf_settings[] = { | |||
| 139 | .in_recv_set_number = 15, | 139 | .in_recv_set_number = 15, |
| 140 | .in_recv_comm_type = PORT100_COMM_TYPE_IN_106A, | 140 | .in_recv_comm_type = PORT100_COMM_TYPE_IN_106A, |
| 141 | }, | 141 | }, |
| 142 | /* Ensures the array has NFC_DIGITAL_RF_TECH_LAST elements */ | ||
| 143 | [NFC_DIGITAL_RF_TECH_LAST] = { 0 }, | ||
| 142 | }; | 144 | }; |
| 143 | 145 | ||
| 144 | /** | 146 | /** |
| @@ -174,6 +176,9 @@ static const struct port100_tg_rf_setting tg_rf_settings[] = { | |||
| 174 | .tg_set_number = 8, | 176 | .tg_set_number = 8, |
| 175 | .tg_comm_type = PORT100_COMM_TYPE_TG_424F, | 177 | .tg_comm_type = PORT100_COMM_TYPE_TG_424F, |
| 176 | }, | 178 | }, |
| 179 | /* Ensures the array has NFC_DIGITAL_RF_TECH_LAST elements */ | ||
| 180 | [NFC_DIGITAL_RF_TECH_LAST] = { 0 }, | ||
| 181 | |||
| 177 | }; | 182 | }; |
| 178 | 183 | ||
| 179 | #define PORT100_IN_PROT_INITIAL_GUARD_TIME 0x00 | 184 | #define PORT100_IN_PROT_INITIAL_GUARD_TIME 0x00 |
| @@ -330,6 +335,10 @@ in_protocols[][PORT100_IN_MAX_NUM_PROTOCOLS + 1] = { | |||
| 330 | [NFC_DIGITAL_FRAMING_NFC_DEP_ACTIVATED] = { | 335 | [NFC_DIGITAL_FRAMING_NFC_DEP_ACTIVATED] = { |
| 331 | { PORT100_IN_PROT_END, 0 }, | 336 | { PORT100_IN_PROT_END, 0 }, |
| 332 | }, | 337 | }, |
| 338 | /* Ensures the array has NFC_DIGITAL_FRAMING_LAST elements */ | ||
| 339 | [NFC_DIGITAL_FRAMING_LAST] = { | ||
| 340 | { PORT100_IN_PROT_END, 0 }, | ||
| 341 | }, | ||
| 333 | }; | 342 | }; |
| 334 | 343 | ||
| 335 | static struct port100_protocol | 344 | static struct port100_protocol |
| @@ -371,6 +380,10 @@ tg_protocols[][PORT100_TG_MAX_NUM_PROTOCOLS + 1] = { | |||
| 371 | { PORT100_TG_PROT_RF_OFF, 1 }, | 380 | { PORT100_TG_PROT_RF_OFF, 1 }, |
| 372 | { PORT100_TG_PROT_END, 0 }, | 381 | { PORT100_TG_PROT_END, 0 }, |
| 373 | }, | 382 | }, |
| 383 | /* Ensures the array has NFC_DIGITAL_FRAMING_LAST elements */ | ||
| 384 | [NFC_DIGITAL_FRAMING_LAST] = { | ||
| 385 | { PORT100_TG_PROT_END, 0 }, | ||
| 386 | }, | ||
| 374 | }; | 387 | }; |
| 375 | 388 | ||
| 376 | struct port100 { | 389 | struct port100 { |
