diff options
| author | Manoj Gupta <manojgupta@google.com> | 2017-02-07 16:21:39 -0800 |
|---|---|---|
| committer | Ruchi Kandoi <kandoiruchi@google.com> | 2017-03-07 09:18:44 -0800 |
| commit | 63f0a64a173a498d11e559b83b7c681ce77f939e (patch) | |
| tree | 39ae5d13a7e48210275f0f875a6b8b805879da57 /halimpl | |
| parent | 75c2082a325012141c6a411aab5db492bf1c7627 (diff) | |
| download | android_hardware_broadcom_nfc-63f0a64a173a498d11e559b83b7c681ce77f939e.tar.gz android_hardware_broadcom_nfc-63f0a64a173a498d11e559b83b7c681ce77f939e.tar.bz2 android_hardware_broadcom_nfc-63f0a64a173a498d11e559b83b7c681ce77f939e.zip | |
Fix clang static analyzer warnings.
system/nfc/halimpl/pn54x/tml/phTmlNfc.c:545:17: warning: Access to field
'pDevHandle' results in a dereference of a null pointer (loaded from
variable 'gpphTmlNfc_Context') [clang-analyzer-core.NullDereference]
system/nfc/halimpl/pn54x/hal/phNxpNciHal.c:461:25: warning: Result of
'malloc' is converted to a pointer of type 'char', which is incompatible
with sizeof operand type 'char *'.
system/nfc/halimpl/pn54x/self-test/phNxpNciHal_SelfTest.c:1291:25:
warning: Result of 'malloc' is converted to a pointer of type 'char',
which is incompatible with sizeof operand type 'char *'
Test: Warnings no longer appears.
Change-Id: I7442d1b90670170c2bd179684156a934894411d0
Diffstat (limited to 'halimpl')
| -rw-r--r-- | halimpl/pn54x/hal/phNxpNciHal.c | 2 | ||||
| -rw-r--r-- | halimpl/pn54x/self-test/phNxpNciHal_SelfTest.c | 2 | ||||
| -rw-r--r-- | halimpl/pn54x/tml/phTmlNfc.c | 3 |
3 files changed, 5 insertions, 2 deletions
diff --git a/halimpl/pn54x/hal/phNxpNciHal.c b/halimpl/pn54x/hal/phNxpNciHal.c index 7a81528..9b7d7c4 100644 --- a/halimpl/pn54x/hal/phNxpNciHal.c +++ b/halimpl/pn54x/hal/phNxpNciHal.c @@ -462,7 +462,7 @@ int phNxpNciHal_open(nfc_stack_callback_t* p_cback, nxpncihal_ctrl.p_nfc_stack_data_cback = p_data_cback; /* Read the nfc device node name */ - nfc_dev_node = (char*)malloc(max_len * sizeof(char*)); + nfc_dev_node = (char*)malloc(max_len * sizeof(char)); if (nfc_dev_node == NULL) { NXPLOG_NCIHAL_E("malloc of nfc_dev_node failed "); goto clean_and_return; diff --git a/halimpl/pn54x/self-test/phNxpNciHal_SelfTest.c b/halimpl/pn54x/self-test/phNxpNciHal_SelfTest.c index 1508813..37d6a3e 100644 --- a/halimpl/pn54x/self-test/phNxpNciHal_SelfTest.c +++ b/halimpl/pn54x/self-test/phNxpNciHal_SelfTest.c @@ -1288,7 +1288,7 @@ NFCSTATUS phNxpNciHal_TestMode_open(void) { memset(&tTmlConfig, 0x00, sizeof(tTmlConfig)); /* Read the nfc device node name */ - nfc_dev_node = (char*)malloc(max_len * sizeof(char*)); + nfc_dev_node = (char*)malloc(max_len * sizeof(char)); if (nfc_dev_node == NULL) { NXPLOG_NCIHAL_E("malloc of nfc_dev_node failed "); goto clean_and_return; diff --git a/halimpl/pn54x/tml/phTmlNfc.c b/halimpl/pn54x/tml/phTmlNfc.c index 2670a05..995c9ba 100644 --- a/halimpl/pn54x/tml/phTmlNfc.c +++ b/halimpl/pn54x/tml/phTmlNfc.c @@ -542,6 +542,9 @@ static void phTmlNfc_TmlWriterThread(void* pParam) { static void phTmlNfc_CleanUp(void) { NFCSTATUS wRetval = NFCSTATUS_SUCCESS; + if (NULL == gpphTmlNfc_Context) { + return; + } if (NULL != gpphTmlNfc_Context->pDevHandle) { (void)phTmlNfc_i2c_reset(gpphTmlNfc_Context->pDevHandle, 0); gpphTmlNfc_Context->bThreadDone = 0; |
