Commit graph

19237 commits

Author SHA1 Message Date
Flavio Santes
6a3ca408cf tests/tinycrypt: Fix wrong sizeof argument in test_ccm_mode (2nd)
This commit fixes an issue in the test_ccm_mode.c file:

sizeof(data) is used to compute the length of the array pointed to
by the 'uint8_t *data' pointer.

At the same function scope, there is a variable (dlen) that already
specifies the required length, so we use that variable instead of
the 'sizeof' function call.

This issue was not reported by Coverity, although is worth to fix it.

Change-Id: I27cbf8c7000a4189a42d193f6445996d4b852aa6
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-18 01:05:32 +00:00
Flavio Santes
5b47ca7395 tests/tinycrypt: Fix wrong sizeof argument in test_ccm_mode
This commit fixes the wrong sizeof argument error reported by
Coverity.

Coverity-CID: 152032

Change-Id: I2ee3089b4b840f4a1b8ba0303e92a3311c07ffeb
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-18 01:05:31 +00:00
Flavio Santes
0f231c70d3 tests/tinycrypt: Fix dead code issue (2nd)
This commit fixes the dead code issue reported by Coverity.

Coverity-CID: 151977

Change-Id: Iaa31c032456f48e1af1d1c9d722f051ac5519ccf
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-18 01:05:30 +00:00
Flavio Santes
7ac025ea14 tests/tinycrypt: Fix dead code issue (1st)
This commit fixes the dead code issue reported by Coverity.

Coverity-CID: 151975

Change-Id: I449341d1f540abe149e8ad9197a64d52cd5722cd
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-18 01:05:29 +00:00
Benjamin Walsh
ad96aa9a5d dlist: fix SYS_DLIST_FOR_EACH_SAFE when operating on empty list
There was no check to see if the head of a list was empty before trying
to fetch the next node in the list. The fix is added to
sys_dlist_peek_next() so that it also return NULL if the node parameter
is NULL, in addition to being the tail of the list.

Since the value is not used until the second iteration of the loop, and
there will be no second iteration if the list is empty, as long as the
CPU does allow reading at address 0, this was not causing any issues.

Our ARC targets did not seem to like that.

Fixes ZEP-1263 and ZEP-1297.

Change-Id: I07ca16592d206d13662226d1249f487ee78c06aa
Signed-off-by: Benjamin Walsh <walsh.benj@gmail.com>
2016-11-18 00:47:25 +00:00
Flavio Santes
9c426ba3f8 test/tinycrypt: Solve style issues in test_hmac_prng
Style issues fixed by this commit:

- Comments
- Variable declaration/definition
- Space between cast

Change-Id: Ia6eb7718c55b976cd0899ede742d89483db191b3
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-18 00:31:10 +00:00
Flavio Santes
9c2c57b730 tests/tinycrypt: Fix wrong sizeof argument
Fix the issue reported by Coverity: wrong sizeof argument.

Coverity-CID: 152042

Change-Id: I5d593ba54bf8f69f3c9d41a8b2878827d1cc186a
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-18 00:31:09 +00:00
Flavio Santes
bb8f324d94 tests/tinycrypt/aes: Replace spaces by tabs
This commit replaces spaces by tabs in the TinyCrypt AES test.

Three 'space required before the open brace' issues are also
fixed by this commit.

Change-Id: I27e961484899873a25847452d569b50322dba74d
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-18 00:27:23 +00:00
Flavio Santes
455ed30fee tests/tinycrypt/aes: Solve style issues in comments
This commit solves some style issues found in comment blocks.

Change-Id: I1f4f7344e33b5898ac7d1fb2cd13d75946b4ee5e
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-18 00:27:23 +00:00
Flavio Santes
ef86c7d6f3 tests/tinycrypt/aes: Variable declarations at the beginning of a block
This commit moves variable declarations at the beginning of the test
routines.

Change-Id: Id1382b64aad4130e9a939c5e51301b75c6958fe5
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-18 00:27:22 +00:00
Flavio Santes
32f04293ca tests/tinycrypt/aes: Remove struct declaration inside function
This commit removes the declaration of a data type inside the tests
3 & 4. The new data type 'struct kat_table' is declared at the
beginning of the file.

Change-Id: I7662cd164a865fe0e70f984b9b494d96b4a72af9
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-18 00:27:21 +00:00
Anas Nashif
3accae1da6 kernel: event_logger: use POST_KERNEL instead of NANOKERNEL
NANOKERNEL is obsolete and this kernel service is still using it causing
deperecaton warnings. Move it to POST_KERNEL

Change-Id: I17fabd080645f93a8599f4ea25da844e1ec5f4bb
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-11-18 00:24:26 +00:00
Anas Nashif
1dd4960738 Revert "build: Handle ALL_LIBS dependencies correctly"
This reverts commit 608abd987c.

This change is breaking build dependencies.

Change-Id: Id8e9dbfc14b72933c402d25847615cddbfaca40d
Jira: ZEP-1291
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-11-18 00:24:03 +00:00
Jithu Joseph
e8c7c0b400 tests: libs: Fix string overflow
This fixes a string overflow past the end of a buffer
which was reported by coverity.

Coverity-CID: 152044

Change-Id: I5b331135e338fa43b5589a9488b06367e8cad5a7
Signed-off-by: Jithu Joseph <jithu.joseph@intel.com>
2016-11-18 00:21:58 +00:00
Baohong Liu
b58b1bbc9c drivers: cc2520: fix variable type mismatching issue
The variable type mismatching was caught by LLVM.

Jira: ZEP-1179

Change-Id: If26c881d207a6cedc52b7589c5d7ebb2040c7ab7
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-11-18 00:21:32 +00:00
Baohong Liu
da622d3ff2 net: ip: fix variable type mismatching issue
The variable type mismatching was caught by LLVM.

Jira: ZEP-1179

Change-Id: I92ca14b7a2c0507a86a6b6abaa567a5091622ad1
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-11-18 00:21:09 +00:00
Baohong Liu
b18e4307b6 samples: net: fix a memcmp len error
The memcmp is a comparison between two strings or buffers.
So, the length should be the buffer length, not the length
of the pointer to the buffer. This was caught by LLVM.

Jira: ZEP-1179

Change-Id: I7fd6b199686b19e7f4a2e1288897483e69ad091e
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-11-18 00:20:12 +00:00
Baohong Liu
2a0554b1e7 net: 802.15.4: Fix a variable type mismatching issue
This variable type mismatching was caught by LLVM.

Jira: ZEP-1179

Change-Id: I891dc9d55055292e6a749f300e995798040d0b24
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-11-18 00:19:13 +00:00
Jithu Joseph
091048172f samples :usb : Check return value fix
This commit fixes a missing function return check reported by
Coverity.

Coverity-CID: 151949

Change-Id: Iedf090b7f2ded9f20ff6d796f1cd5c02990b0a4e
Signed-off-by: Jithu Joseph <jithu.joseph@intel.com>
2016-11-18 00:12:23 +00:00
Sergio Rodriguez
b03ddf491f samples: drivers: gpio: Exit from testcase if device not found
Exiting from the test case when the gpio device is not found, this
to avoid a null pointer dereference

This issue was reported by Coverity

Coverity-CID: 151980

Change-Id: I44f13131d44c7c093781e1f11f8481e7ef8175c9
Signed-off-by: Sergio Rodriguez <sergio.sf.rodriguez@intel.com>
2016-11-18 00:05:31 +00:00
Baohong Liu
df08319473 tests: benchmark: fix a string format issue
A popular issue "format is not a string literally" was
caught by LLVM. Let's make it a string literally.

Jira: ZEP-1179

Change-Id: I2b4a5aef750b772504bf0e6f005dab2ff9ac3e7c
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-11-18 00:02:11 +00:00
Sergio Rodriguez
41004171d3 samples: drivers: i2c fram : Exit from testcase if device not found
Exiting from the test case when the gpio device is not found, this
to avoid a null pointer dereference

This issue was reported by Coverity

Coverity-CID: 151982

Change-Id: Ifaed47b2b48359dacfdb3111ca2895d5912779e6
Signed-off-by: Sergio Rodriguez <sergio.sf.rodriguez@intel.com>
2016-11-18 00:01:34 +00:00
Baohong Liu
fb83ea9cc6 drivers: rtc: fix enum type mismatching issue
The enum type mismatching was caught by LLVM.

Jira: ZEP-1179

Change-Id: I50b68e201ef6fb18a02eeda2a2e7548dad3f358c
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-11-17 23:39:25 +00:00
Baohong Liu
d5ccac16be tests: spi: add return value check
Add function return value check. This was caught by
Coverity.

Coverity-CID: 151950

Change-Id: Iee550e15d124f05f0b0514fdad22d06c617beac2
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-11-17 14:42:58 -08:00
Benjamin Walsh
32698293c8 kernel/arm: fix race condition when setting _Swap() return value
There was a possible race condition when setting the return value of a
thread that is pending, from an ISR.

A kernel function causes a thread to pend, with the following series of
steps:

- disable interrupts
- move current thread to wait_q
- call _Swap

Depending if running on M3/4 or M0+, _Swap will either issue a svc #0,
or pend PendSV directly. The same problem exists in both cases.

M3/4:
__svc will:
- enable interrupts
- trigger __pendsv

M0+:
_Swap() will enable interrupts.

__pendsv will:
- save register context including PSP into the thread struct

If an interrupt occurs between interrupts being enabled them and
__pendsv saving PSP, and the ISR sets the pending thread's return value,
this will happen:

- sees the thread in a wait_q
- removes it
- makes it ready
- calls _set_thread_return_value
- _set_thread_return_value looks at the thread's saved PSP to poke
  the value

In this scenario, PSP hasn't yet been updated by __pendsv so it's a
stale value from the previous context switch, resulting in unpredictable
word on the stack getting set to the return value.

There is no way to fix this issue and still have the return value being
delivered directly in the pending thread's exception stack frame, in the
M0+ case. There will always be a window between the unlocking of
interrupts and PendSV being handled. On M3/4, it could be possible with
the mix of SVC and PendSV, since the exception stack frame is created in
the __svc handler. However, because we want to keep the two
implementations as close as possible, and there were talks of moving
M3/4 to using PendSV only, to save an exception, the approach taken
solves both cases.

The approach taken is similar to the ARC and Nios2 ports, where
there is a field in the thread structure that holds the return value.
_Swap() then loads r0/a1 with that value just before returning.

Fixes ZEP-1289.

Change-Id: Iee7e06fe3f8ded84aff918fd43408c7f589344d9
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-11-17 14:46:12 +00:00
Inaky Perez-Gonzalez
11bd718733 fatal error handlers: report which thread croaked
When a thread dies, at least print the pointer to it, so we can debug
better.

Change-Id: Ief6bbc0c221e2d5271c240a4b73df16413aa5e22
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2016-11-17 14:36:50 +00:00
Sergio Rodriguez
6c393fa393 drivers: gpio: Remove contradictory if statement evaluation
This fixes an always false evaluation of the gpio I/O direction

This issue was reported by Coverity (CID 150821).

Change-Id: I6c0e9fe405cbd3e35454a81754fa0b1c721691f0
Signed-off-by: Sergio Rodriguez <sergio.sf.rodriguez@intel.com>
2016-11-17 14:23:28 +00:00
Sergio Rodriguez
23a0f6c918 drivers: gpio_ss: Remove contradictory if statement evaluation
This fixes an always false evaluation of the gpio I/O direction

This issue was reported by Coverity

Coverity-CID: 151833

Change-Id: Ie952d6f50c0383d5631325b69e8e8b234c67c4b8
Signed-off-by: Sergio Rodriguez <sergio.sf.rodriguez@intel.com>
2016-11-17 14:23:24 +00:00
Sergio Rodriguez
97c5020079 drivers: gpio_k64: Remove contradictory if statement evaluation
This fixes an always false evaluation of the gpio I/O direction

This issue was reported by Coverity

Coverity-CID: 151834

Change-Id: I033e368b2e91d888f2e8a797490df757513c3906
Signed-off-by: Sergio Rodriguez <sergio.sf.rodriguez@intel.com>
2016-11-17 14:23:19 +00:00
Sergio Rodriguez
02902df44b samples: aio comparators: Use expected pointer type in printf
The data structure member being used  is character array,
dereferencig this array gives **char instead of the expected
*char type.

This issue was reported by Coverity

Coverity-CID: 152030
Coverity-CID: 152033

Change-Id: Ied67e4b2d47017e6ad5e40b9b6fca1b496c483ed
Signed-off-by: Sergio Rodriguez <sergio.sf.rodriguez@intel.com>
2016-11-17 14:23:13 +00:00
Flavio Santes
5f818bfcd3 sensors/mcp9808: Evaluate sensor_channel_get return code
The sensor_channel_get return code is now evaluated.

Change-Id: Ib931d6caba65af7195bad53c62e6e5a3033b49e8
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-17 01:30:00 -06:00
Flavio Santes
0e20d45272 sensors/mcp9808: Evaluate sensor_sample_fetch return code
sensor_sample_fetch return code is now evaluated.

Coverity-CID: 151957

Change-Id: I79b9f44c79ac13e8d7da55c9e3866ad504a4a450
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-17 01:25:12 -06:00
Marti Bolivar
f75762258a serial: fix up uart_poll_in docstring
The uart_poll_in() Doxygen comment has a typo ("if empty" should be "is
empty"). Fix it up and make it more clear.

Change-Id: I222051dedc6036e70ce94e8046084d763628ff13
Signed-off-by: Marti Bolivar <marti.f.bolivar@gmail.com>
2016-11-16 22:57:30 +00:00
Inaky Perez-Gonzalez
c41d88fd11 libc: atoi() avoid fallthroughs in switch cases
This is a tentative fix for CID 93807, a valid Coverity warning;
however the code is valid too.

We can choose to silence the warning or rewrite the code in a way that
makes it more verbose but keeps Coverity happy.

Coverity complains about doing an implicit fallthrough in switch case
statement. I prefer patching the code to make it explicit, as the
compiler will optimize out, to avoid having to constantly filter out
the checker's warnings.

Coverity-CID: 93807
Change-Id: I7be334d48567bf52fc2b21de043310e0f73b72db
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2016-11-16 22:05:53 +00:00
Allan Stephens
ac4a351ba9 kernel: Enhance naming of memory pool configuration options
Replaces confusing (and excessively long) configuration option
names with more intuitive names. Also enhances the description
of each option to clarify its use.

Change-Id: If4d4541407627482b1e90302cfc9df3bc8130d44
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-11-16 21:43:17 +00:00
Allan Stephens
436094023e doc: Incorporate kernel APIs into API documentation guide
Change-Id: Ib5e5aa14534af4789d8247e6096913e09731f5bb
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-11-16 21:43:17 +00:00
Allan Stephens
d423cd3c0f doc: Various corrections to Kernel Primer
* Ensures all references to kernel functions are correctly
  tagged so they will auto-link to the API guide.

* Adds references to a few functions and macros that were
  omitted.

Change-Id: I26ccd9c29ea123db2807f2df4d05d574932c6849
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-11-16 21:43:16 +00:00
Allan Stephens
c98da84e69 doc: Various corrections to doxygen info for Kernel APIs
Most kernel APIs are now ready for inclusion in the API guide.
The APIs largely follow a standard template to provide users
of the API guide with a consistent look-and-feel.

Change-Id: Ib682c31f912e19f5f6d8545d74c5f675b1741058
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-11-16 21:43:16 +00:00
Vincenzo Frascino
f880c250dd adc: Cleanup ti 108s102 adc driver
This patch adds the "static" keyword to all the functions that have a
containing file scope.

Change-Id: I0692b389da7f4bf591b5e33f7481bf3dcbbf9801
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
2016-11-16 11:26:54 -06:00
Vincenzo Frascino
95f06a5657 adc: Cleanup qmsi ss adc driver
This patch adds the "static" keyword to all the functions that have a
containing file scope.

Change-Id: I28e7daef19359759afb09cd196f659a81c758ea1
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
2016-11-16 11:26:54 -06:00
Vincenzo Frascino
9192e55ff4 adc: Cleanup qmsi adc driver
This patch adds the "static" keyword to all the functions that have a
containing file scope.

Change-Id: I12c29f83e5e8a7eb51880d481da17666764b2c2b
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
2016-11-16 11:26:54 -06:00
Vincenzo Frascino
0dfab90d30 adc: Cleanup DW adc driver
This patch adds the "static" keyword to all the functions that have a
containing file scope.

Change-Id: Ib05943b53b6863b5b44848ecb2199b7e99d24139
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
2016-11-16 11:26:54 -06:00
Vincenzo Frascino
c3b54339da adc: Cleanup main Kconfig
This patch addresses the following issues:
* Aligns the Kconfig code style with Zephyr projects requirements.
* Removes redundant "depends on" from Kconfig.

Change-Id: I46a156581cdf79d0ba8f0030ce7b595469db1bcb
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
2016-11-16 11:26:54 -06:00
Vincenzo Frascino
add1b55dca gpio: Cleanup DW gpio driver
This patch addresses the following issues:
* Aligns the Kconfig code style with Zephyr projects requirements.
* Removes redundant "depends on" from Kconfig.
* Adds static to the gpio_dw_isr declaration.
* Adds guards to the header files.

Change-Id: I1ae70868f0bda97891cbeb494e5efba1bd537aa1
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
2016-11-16 17:18:01 +00:00
Vincenzo Frascino
0ff548a0e0 gpio: Cleanup Kconfig for K64F
This patch addresses the following issues:
* Aligns the Kconfig code style with Zephyr projects requirements.
* Removes redundant "depends on" from Kconfig.

Change-Id: I4c8df0999f92a834d4023ce5856a2a6c39797c00
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
2016-11-16 17:18:01 +00:00
Vincenzo Frascino
2a8eb46f5c gpio: Cleanup Kconfig dependancy for nRF5X support
This patch removes a redundant "depends on" from the gpio Kconfig for
nRF5X family.

Change-Id: I28ac15b58839e05f47ade81bef66a03a0a44bebd
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
2016-11-16 17:18:00 +00:00
Vincenzo Frascino
9e7fec0ca4 gpio: Cleanup Atmel SAM3 gpio driver
This patch addresses the following issues:
* Aligns the Kconfig code style with Zephyr projects requirements.
* Removes redundant "depends on" from Kconfig.
* Adds static to the gpio_sam3_init declaration.

Change-Id: If5c8a1822d6c116ea34d0f220f3e5fa359b6fa18
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
2016-11-16 17:18:00 +00:00
Flavio Santes
da5dd09875 tinycrypt: Update CTR PRNG test case
This commit updates the TinyCrypt CTR PRNG test application.

See: https://github.com/01org/tinycrypt/
Commit: 601f6a26ab4505ac82a2fb13ae4757c2b8d3eba8

Change-Id: I9f5d92b9abbcf9608065992b05f114667a768c76
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-16 16:52:04 +00:00
Flavio Santes
f73c86d096 tinycrypt: Fix style issues
This commit solves some style issues found at the
tests/include/test_utils.h file:

- Lines over 80 characters
- Unused arguments
- Missing {} in if-else

Change-Id: Ifaee81ec7c57a250b2c368b2efda38dc69d02c81
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-16 16:51:57 +00:00
Flavio Santes
1a19e14d97 tinycrypt: Fix bug in CTR PRNG reseed function
This commit fixes a bug found in CTR PRNG reseed function to correctly
use the seed material.

See: https://github.com/01org/tinycrypt
Commit: 601f6a26ab4505ac82a2fb13ae4757c2b8d3eba8

Change-Id: I01216484bd1ee980b0e2da7fdc752a952f217ef0
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-16 16:51:53 +00:00