According to the Coverity issue 188890 (github issue #10705)
Fix for overflowed or truncated value count-1U used as return value.
I decided to use a saturating subtract to avoid a vulnerability.
It will always return 0 or bigger value according to the conditions.
Now if count value is 0, function will return 0, not -1 as before.
Signed-off-by: Maksim Masalski <maxxliferobot@gmail.com>
Added __weak keyword to to support overriding assert_post_action().
This allows system designers to change/augment the assert behaviour,
i.e. add logging to persistant storage of program counter, line
number etc, and/or change reboot behaviour.
Signed-off-by: Tim Sørensen (TIMS) <tims@oticon.com>
The SimpleLink driver has been defining these macros for its local use.
Given these have been defined in a recent commit in Zephyr
(9c86dbfd8e), we should now avoid
redefining them to prevent build errors.
Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
We are doing math of two 32-bit numbers and assigning into a 64-bit
result. Add explicit cast of one of the values being multipled to get
explicit promotion.
Fixes: #13883
Coverity CID: 190930
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
The return from ipm_set_enabled wasn't assigned to 'status' so the check
right after the call to ipm_set_enabled() wasn't doing the right thing.
Fixes: #13881
Coverity CID: 190932
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Inside cmd_read(), result of fs_seek() is not checked which might
result in reading the wrong part of file. So fails the read if
fs_seek() fails.
Fixes#13862
Fixes CID-190953
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
The reftime variable used for performance numbers is not initialized
prior to being used. Initialize it to the current uptime so delta
can be calculated correctly.
Fixes#13877
Fixes CID-190936
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Inside test_file_truncate(), the results of fs_seek() are not
checked. So adds some checks there.
Fixes#13874
Fixes CID-190939
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
If we receive the ARP request, then check if the ARP cache
contains an entry for this IP address already. If it does,
then update the MAC address in the cache.
Fixes#10188
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
The INTMUX_LABEL define generated by DTS is marked as deprecated us
DT_OPENISA_RV32M1_INTMUX_INTMUX_LABEL instead.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
The driver was using non-'DT_' prefixed defines which are deprecated.
Move to using proper 'DT_' prefix defines.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
There is no symbol called CONFIG_SRAM. Mention CONFIG_SRAM_SIZE and
CONFIG_SRAM_BASE_ADDRESS instead, and also mention that the DT_* values
they're generated from.
This gets rid of a false-positive undefined Kconfig symbol reference
too.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
UART_QMSI_0_BAUDRATE was removed by commit 17c6456678 ("drivers/uart:
Use dts to set uart priorities for QMSI driver").
There's a reference to CONFIG_UART_QMSI_1_BAUDRATE as well, but getting
rid of it requires documentation updates.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Might have been overlooked in commit b52c0f24a6 ("net/ieee802154: Make
RAW mode generic") and commit f4664f1d9a ("drivers/ieee802154: Cleaning
up CMakeLists.txt").
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
CONFIG_ADC_QMSI_SAMPLE_WIDTH was removed in commit acc40d990a ("adc:
remove adc_qmsi driver"). It's only used as an example in the
documentation, but might as well use an existing symbol instead.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Exactly one caller of pthread_barrier_wait() should receive a return
value of PTHREAD_BARRIER_SERIAL_WAIT; all others should receive zero
(or an error code). Added a test to match.
Fixes: #9953
Signed-off-by: Charles E. Youse <charles.youse@intel.com>
During speculative execution, non-present pages are treated
as valid, which may expose their contents through side
channels.
Any non-present PTE will now have its address bits zeroed,
such that any speculative reads to them will go to the NULL
page.
The expected hit on performance is so minor that this is
enabled at all times.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Removing the build_only option for tickless broke CI (for reasons
unrelated to the new tests I added in the prior commit).
Signed-off-by: Charles E. Youse <charles.youse@intel.com>
In some circumstances (e.g., a tickless kernel), k_timer_remaining_get()
would not account for time passed that didn't involve clock interrupts.
This adds a simple fix for that, and adds a test case. In addition, the
return value of k_timer_remaining_get() is clamped at 0 in the case of
overdue timers and the API description is adjusted to reflect this.
Fixes: #13353
Signed-off-by: Charles E. Youse <charles.youse@intel.com>
The SOC code can set whether it's known that the CPU
is immune, don't default to turning this off.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Retpolines were never completely implemented, even on x86.
Move this particular Kconfig to only concern itself with
the assembly code, and don't default it on ever since we
prefer SSBD instead.
We can restore the common kernel-wide CONFIG_RETPOLINE once
we have an end-to-end implementation.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
- Remove redundant dependencies on the PWM symbol (which show up as
PWM && PWM in the documentation). The 'source's in
drivers/pwm/Kconfig are already within an 'if PWM' block.
- Turn some repeated 'depends on FOO' into 'if FOO' blocks.
- Turn some 'if FOO's that surround a single symbol into
'depends on FOO'.
'if FOO' is equivalent to adding a 'depends on FOO' to each symbol
within the 'if'.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
The feature that used this symbol was removed in 18b07e09e0.
This is just a cleanup commit that removes the unused symbol.
Signed-off-by: Tomasz Gorochowik <tgorochowik@antmicro.com>
This test was written to wait on a fifo with a timeout, return, and
check the timing between the start and end using k_cycle_get_32() to
see that it didn't run long. But timeouts expire on tick boundaries,
and so if tick expires between the start of the test and the entry to
k_fifo_get(), the timeout will take one full tick longer than expected
due to aliasing.
As it happened this passed everywhere except nRF (whose cycle timer is
32 kHz and thus more susceptible to coarser aliasing like this), and
even there it passed for a while until the spinlock validation layer
went in and added just enough time to the userspace code paths
(i.e. the code between the start time fetch and the point where the
fifo blocks takes longer) to open the window and push us over the
limit.
The workaround here is just to add a k_sleep(1) call, which is
guaranteed to block and wake up synchronously at the next tick.
Fixes#13289
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
nRF52810 Flash and SRAM sizes do not have power-of-two values.
This commit reduces the amount of MPU regions reserved at boot
time to enforce basic permissions in Flash and SRAM memory. It
does this by selecting the next power-of-two size for the Flash
and SRAM regions, respectively. In this way we can cover the
entire Flash and SRAM space each with a single MPU region, thus,
save two MPU regions to be used by the kernel/application.
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
These options were removed from kconfig in previous patch. So rename
the leftovers as shared_irq driver options are defined in DTS now.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
These options were removed from kconfig in previous patch. So rename
the leftovers as shared_irq driver options are defined in DTS now.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
These options were removed from kconfig in previous patch. So rename
the leftovers as shared_irq driver options are defined in DTS now.
Fix#13746
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Some old peer central controllers respond with Unknown
Response PDU to our local Slave Initiated Feature Request
after the peer initiated the Encryption Setup Procedure.
The peer has voilated the Bluetooth Specification by sending
the Unknown Response during the Encryption Setup Procedure,
but as a workaround to IOP with such controller our local
implementation is updated to not disconnect the connection
but accept the voilating Unknown Response PDU.
Relates to #12362.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Following changes done:
* While looking through generated net_buf HTML documentation
I noticed that some of the macros were not documented.
* Removed extern variable declarations from generated
documentation (because those variables were not documented).
* Replaced "/** @brief xxx" by "/**\n * @brief xxx" as
checkpatch complained about them (@brief being in the same
line as the start of the block comment).
* Went through all the block comments and made them look similar
and removed extra space character.
* Removed duplicate lines from function documentations. So
if the @brief text is the same as the detailed one, then the
generated output was looking funny.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
CCC cfg value was not being cleared on disconnection of a non bonded
peer if another peer was connected, had non zero value and occurred
earlier in the ccc cfg array.
Signed-off-by: Nick Ward <nick.ward@setec.com.au>
These options are oftentimes used when implementing servers, and
thus required to port existing socket apps. These options are also
safe to just ignore, e.g. SO_REUSEADDR has effect only for repeated
recreation of server socket (not an expected usecase for a Zephyr
app), while TCP_NODELAY is effectively the default for Zephyr, as we
don't implement TCP buffering (aka Nagle algorithm).
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
These can be used as getsockopt/getsockopt params and required for
compatibility with existing socket applications.
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
We expect that identifier in yaml will match board name for sanitycheck.
Change the identifier to match so sanitycheck runs propertly.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Checking the return of fs_stat to ensure that there is not hidden error.
Problem spotted by coverity.
CID 190949
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
Multiple flag bits were set so the ACK flag set was not checked
properly which meant that connection establishment was not
successfull.
Fixes#13943
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>