Commit graph

41120 commits

Author SHA1 Message Date
Tedd Ho-Jeong An
5d35b66327 Samples: net: can: initialize the variables
Initialize the variables.

Fix Bug: #14819
Coverity CID: 196637

Signed-off-by: Tedd Ho-Jeong An <tedd.an@intel.com>
2019-03-24 10:55:06 -05:00
Flavio Ceolin
f1741dab6c tests: mbox: Check k_mbox_get return
Coverity was complaining that this function was not being checked only
in a specific case.

Coverity CID: 183066

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2019-03-23 20:13:12 -04:00
Ulf Magnusson
c8687915ce x86: gen_mmu_x86: Fix error-reporting code for non-page-aligned region
%z isn't available in Python, and makes the code raise a ValueError. Use
%d instead. Integers in Python 3 are not sized/signed (though it's
probably a typo from C).

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-03-23 19:53:16 -04:00
Andy Ross
61065b3235 tests: samples: Re-enable SMP on a few tests
The 14 individual cases that use these four config files are now
passing reliably when SMP is enabled, after the "Mark sleeping threads
suspended" scheduler fix.  Turn it back on.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-03-23 19:28:15 -04:00
Andy Ross
09fdd814df tests/kernel/smp: Give time for a wakeup to take effect
For obvious performance reasons, scheduler state changes (other than
aborting a thread) do not cause synchronous interrupts on the other
CPU.  Doing a k_thread_wakeup() means that the current CPU will run it
synchronously if it's high priority, but if you want to see it run on
the other cores you need to wait for them to reach a scheduling point
on their own.

The test was written to assume that k_thread_wakeup() is synchronous,
but that's not right, and it needs to spin a bit.  This bug was always
present in the test, but masked by a bug in the way that k_sleep() was
handled on SMP.  See #9506.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-03-23 19:28:15 -04:00
Andy Ross
4521e0c111 kernel/sched: Mark sleeping threads suspended
On SMP, there was a bug where the logic that re-adds _current to the
run queue at swap time would accidentally reschedule threads that had
just gone to sleep, because the is_thread_prevented_from_running()
predicate only tests for threads that are "suspended" or "pending" and
not sleeping.

Overload _THREAD_SUSPENDED to indicate "sleeping" also.  Simple fix
for an immediate bug, though long term we really want to unify all the
blocked conditions to prevent this kind of state bug.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-03-23 19:28:15 -04:00
David B. Kinder
223bbecf45 doc: fix ACRN board list format
One of the bullet list items didn't get rendered properly because
continuation line wasn't indented.

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2019-03-23 19:26:27 -04:00
Johan Hedberg
7c4a229b0e settings: Fix check for duplicate when new value is smaller
The code for checking duplicates in the existing settings store was
incorrectly identifying a new value with the same initial content but
shorter length as a duplicate. Fix this by doing an early check on a
new vs old length mismatch, and immediately flag this as not a
duplicate.

Fixes #14840

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2019-03-23 22:47:00 +02:00
Johan Hedberg
58b17ed0e5 settings: Enforce value & length consistency in settings_save_one()
Enforce that NULL value is never given with a non-zero length. This
way we don't need to check this over and over again further down the
call path.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2019-03-23 22:47:00 +02:00
Andy Ross
e59d19628d kernel/sched: Rework prio validity assertion
This is throwing errors in static analysis, complaining that comparing
that a prior is higher and lower is impossible.  That is wrong per my
eyes (I swear I think it might be cueing off the names of the
functions, which invert "higher" and "lower" to match our reversed
priority numbers).

But frankly this was never a very readable macro to begin with.
Refactor to put the bounds into the term, so the static analyzer can
prove it locally, and add a build assertion to catch any errors (there
are none currently) where the low<->high priority range is invalid.

Long term, we should probably remove this macro, it doesn't provide
much value.  But removing it in response to a static analysis failure
is... not very responsible as a development practice.

Fixes #14816
Fixes #14820

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-03-23 09:53:55 -05:00
Flavio Ceolin
9d5936c04f lib: posix: fs: Fix access invalid memory
fs_dirent.name is MAX_FILE_NAME + 1 bytes long, not PATH_MAX. Just
fixing it to avoid access invalid memory.

Coverity CID: 186037

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2019-03-23 09:52:51 -05:00
Flavio Ceolin
8945426026 samples: 96_argonkey: sensors: Check function return
Checking the return of sensor_trigger_set and if it fails log the
problem and exits.

Coverity CID: 186196

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2019-03-23 09:52:51 -05:00
Flavio Ceolin
ef0417fa6d samples: ipc: openamp: Avoid dead code
Checking the return of metal_init to avoid having dead code.

Coverity CID: 190932

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2019-03-23 09:52:51 -05:00
Andrei Gansari
22cf6d98ee arch: arm: fix thread's FPU initialization
FPU's control and status register (FPCSR) for a thread is not
initialized. Random values are written to this register and this leads
to failure on fp_sharing test.
FPCSR register is set to 0 according to the value of FPDSCR.

Signed-off-by: Andrei Gansari <andrei.gansari@nxp.com>
2019-03-22 11:17:44 -05:00
Wayne Ren
62da238571 board: emsk: fix the wrong info about DDR
DDR's info should come from DT_MMIO_SRAM_0

Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
2019-03-22 08:35:26 -05:00
Wayne Ren
b962789b9e board: emsk: fix the bug in dts
As em7d is configured with HARVARD, CCM will be used not DDR,
SRAM should point to DCCM.

This bug will cause the wrong caculation of heap area,

Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
2019-03-22 08:35:26 -05:00
Joakim Andersson
66d339a7c9 Bluetooth: controller: Fix scanner memory corruption
Fix a bug where the controller would use the length
field of the advertisement packet before checking
if the length field was valid.
It is possible that the controller has received a packet
that passes CRC check but has a length field that is invalid.
This would cause the scanner to overwrite the scan report
buffer

Fixes: #14741
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2019-03-22 13:58:24 +01:00
Wayne Ren
bcdfc9f1ac arch: arc: fix the unaligned declaration of saved_value
the original declaration is not aligned to 4 bytes.

Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
2019-03-22 07:21:11 -05:00
Erwan Gouriou
2a605ea226 boards: stm32f4_disco: Update openocd config
When using V0.10.0 SDK, flashing is not working anymore on
stm32f4_disco.
Using st_nucleo_f4.cfg instead of stm32f4discovery.cfg solves
the issue.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2019-03-22 07:19:32 -05:00
Luiz Augusto von Dentz
ef9c7a4b5d Bluetooth: samples: IPSP: Fix not checking return of net_pkt_read
net_pkt_read may fail in which case the error shall be reported back
instead of always assuming the whole packet was read.

Fixes #14817

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2019-03-22 12:13:42 +02:00
Carles Cufi
cb44b7e768 doc: Bluetooth: Document the debug monitor and btmon in general
Move the original documentation in the arduino_101 board to a common
section in the Bluetooth documentation and document the use of `btmon`
in general.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2019-03-21 17:23:08 +02:00
Carles Cufi
c616f215b0 boards: nrf: Add bt-mon-uart to all nRF-based boards
Add the bt-mon-uart chosen node to all the nRF-based boards so that they
can all use CONFIG_BT_DEBUG_MONITOR without additional changes.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2019-03-21 17:23:08 +02:00
Arun Joshi
373a42b861 host-tools.cmake: Corrected sdk download url
Corrected sdk download url for 0.10.0

Signed-off-by: Arun Joshi <arun1.joshi@intel.com>
2019-03-21 09:07:53 -05:00
Jukka Rissanen
cda61d2a63 samples: net: dhcpv4: Add net-shell and e1000 driver support
The dhcpv4-client is more usable if it has net-shell. For testing
with qemu_x86, the e1000 overlay config is very useful.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-03-21 09:03:26 -05:00
Andrei Emeltchenko
5a7fd0ebc9 usb: netusb: ecm: Print packet hexdump only for VERBOSE_DEBUG
Use VERBOSE_DEBUG to enable net_pkt_hexdump().

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2019-03-21 09:01:36 -05:00
Andrei Emeltchenko
4496e99869 usb: netusb: rndis: Remove old unused code
Remove old unused code sending media status, sending this packet
causes Windows problems although Linux works with it. Removing this
code does not affect RNDIS functionality.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2019-03-21 09:01:36 -05:00
Andrei Emeltchenko
276f50a623 usb: netusb: rndis: Fix maximum RNDIS frame size
Use standard NET_ETH_MAX_FRAME_SIZE in calculation adding space for
ethernet header.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2019-03-21 09:01:36 -05:00
Andrei Emeltchenko
48be0443b7 usb: netusb: eem: Add check for large packets
Make sure we do not overwrite tx_buf.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2019-03-21 09:01:36 -05:00
Andrei Emeltchenko
f4bfca6e44 usb: netusb: eem: Use NET_ETH_MAX_FRAME_SIZE as frame size
Use standard NET_ETH_MAX_FRAME_SIZE for frame size calculation. This
changes buffer from 1522 to 1514 + 2 + 4. Remove also magic numbers.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2019-03-21 09:01:36 -05:00
Andrei Emeltchenko
57041dd9c0 usb: netusb: ecm: Add check for large packets
Make sure we do not overwrite tx_buf.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2019-03-21 09:01:36 -05:00
Andrei Emeltchenko
7ee481aad7 usb: netusb: ecm: Use NET_ETH_MAX_FRAME_SIZE as frame size
Use standard defined frame size for buffer and wMaxSegmentSize
parameter. Changes frame size from 1522 to 1514.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2019-03-21 09:01:36 -05:00
Andrei Emeltchenko
00c58f770b usb: netusb: rndis: Add check for large packets
Drop packets larger then tx_buf.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2019-03-21 09:01:36 -05:00
Andrei Emeltchenko
742c177977 usb: netusb: Cleanup USB Ethernet networking
Cleanup ECM, EEM and RNDIS networking functions, removing unneeded
headers and unused definitions.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2019-03-21 09:01:36 -05:00
Kumar Gala
7aa98f7196 ci: Bump to image 0.6.4 for west
Move to using CI image to 0.6.4 for west version 0.5.6

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-03-21 09:00:57 -05:00
Johan Hedberg
3ebd9b4a09 Bluetooth: Mesh: Fix clearing model binding and subscriptions
The code for clearing model bindings and subscriptions was flawed in
that proper "cleared" entries were never stored in settings. The code
must pass 0 and NULL to settings_save_one() in case the entry is
desired to be cleared.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2019-03-21 10:10:52 +02:00
Johan Hedberg
dac335c238 Bluetooth: Mesh: Fix clearing model subscription list
The code was storing a "cleared" entry in storage for every model,
regardless of them having any subscriptions or not. Update hte
mod_sub_list_clear() function to return a "cleared entries" count so
that the calling code can decide whether any action is needed or not.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2019-03-21 10:10:52 +02:00
Johan Hedberg
a0d762999d Bluetooth: Mesh: Clean up logging related to settings storage
Remove redundant "val (null)" logs and add a few missing BT_DBG()
calls to make the tracing of storage handling easier.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2019-03-21 10:10:52 +02:00
Johan Hedberg
4cac39e14a Bluetooth: Fix missing return statement in le_conn_param_req()
The le_conn_param_req() function was missing a return statement in
case of a failed connection lookup. This could lead to replying to the
connection parameter request twice as well as passing NULL to
bt_conn_unref(). The latter issue also triggered a Coverity warning.

Fixes CID 196638

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2019-03-21 10:05:47 +02:00
Marc Herbert
7d3fbfccd1 host-gcc/target.cmake: stop discarding CMAKE_<tool>_FLAGS for x86
Prepend -m32 to existing flags as opposed to silently override and
discard them:

- set(CMAKE_<tool>_FLAGS                -m32 )
+ string(PREPEND CMAKE_<tool>_FLAGS   " -m32")

This stops discarding additional flags passed with either cmake
-DCMAKE_<tool>_FLAGS="-fu -bar" or cmake -C params.cmake.

Note this bug was affecting only the combination of x86 and
CMAKE_<tool>_FLAGS. x86_64 wasn't affected and other, non-empty
CMAKE_<tool>_FLAGS_[DEBUG/RELEASE/etc.] weren't affected either.

Also convert flags string to list when invoking --print-libgcc-file-name
to support more than one CMAKE_C_FLAGS.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2019-03-21 00:21:27 -07:00
Andrew Boie
1f6ab221f2 arc: fix off-by-one in mpu_buffer_validate()
The code was probing the byte immediately after the last byte
of the buffer, instead of the last byte of the buffer.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-03-20 18:33:08 -07:00
Daniel Leung
71b4137d30 adc: overhaul adc_dw and rename it to adc_intel_quark_se_c1000_ss
Since commit 0906a51dac, the driver
fails the test: tests/drivers/adc/adc_api. Some of the workflow
turns out to be incorrect (e.g. not doing dummy conversion after
getting out of deep power down, and not clearing interrupt status
bits). So take some time to overhaul the driver. Also rename
the driver to adc_intel_quark_se_c1000_ss because the inner
working of this driver is tied to Quark SE C1000 SoC.

Fixes: #12632

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2019-03-20 18:11:33 -07:00
Daniel Leung
86e473832a adc: quark_d2000: fix sampling conversion
The logic in sampling is incorrect. The code sets up the hardware
to do multiple conversions, but in reality, each call is simply
one conversion. So fix it.

Fixes #12632

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2019-03-20 18:11:33 -07:00
Charles E. Youse
8e85d7d6c0 net/ip: fix input packet filtering criteria
The "is this packet for us?" filter in net_ipv4_input() has a minor
logic error which fails to discard many packets which are.. not for us.

Fixes: #14647

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
2019-03-20 16:37:12 -05:00
Andrzej Puzdrowski
6b62e5e44e settings: remove dead code
Patch removes dead, replaced code which was accidentally not
removed within the stream-codec PR #9521.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2019-03-20 16:35:19 -05:00
Jukka Rissanen
bf8d391ad4 net: context: Check if we run out of mem
The context_alloc_pkt() might run out of memory, and if that
happens we must not try to set the context pointer in it.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-03-20 16:32:16 -05:00
Paul Sokolovsky
69afd80a3d net: ip: connection: Typo fixes in comment
Fix typos and reword code comment on module dependencies a bit.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2019-03-20 16:24:05 -05:00
Andrew Boie
f4631d5b43 kernel: amend comment in k_thread_create handler
This behavior is expected and not of any concern.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-03-20 13:59:26 -07:00
Andrew Boie
d0035f9779 kernel: fix stack size check in k_thread_create
The pointer arithmetic used didn't account for ARC
supervisor mode stacks, which are allocated at the
end of the stack object. Use the new macro to know
exactly how much space is reserved.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-03-20 13:59:26 -07:00
Andrew Boie
575abc0150 kernel: add K_THREAD_STACK_RESERVED
This is used to have each arch canonically state how much
room in the stack object is reserved for non-thread use.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-03-20 13:59:26 -07:00
Andrew Boie
02f64c6846 arm: remove duplicate stack macro docs
These intefaces are already documented in kernel.h.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-03-20 13:59:26 -07:00