This reverts commit 043bb58488.
Note that scripts/requirements-actions.txt might not be 100% the same
as what was pinned prior to the revert due to it being difficult to
restore previous versions while also accounting for the new dependencies
that were added in the meantime.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Virtio headers are moved to zephyr/drivers/ as they have no reason to be
top-level headers since virtio is a driver class.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Fix a bug in zbus_chan_rm_obs() where removing the first observer in a
channel's observer list would cause undefined behavior due to accessing
a member of a NULL pointer.
The issue occurred when prev_obs_nd was NULL (indicating the first node
in the list) and the code attempted to pass &prev_obs_nd->node to
sys_slist_remove(). This resulted in accessing the 'node' member of a
NULL pointer, which is undefined behavior even when taking its address.
The sys_slist_remove() function is designed to handle a NULL prev_node
parameter correctly for removing the first element in a list. The fix
ensures we pass NULL directly instead of attempting to compute the
address of a member within a NULL pointer.
This was detected by Undefined Behavior Sanitizer as "member access
within null pointer".
Signed-off-by: Jan Tore Guggedal <jantore.guggedal@nordicsemi.no>
Peripheral clocks are currently not being disabled for JTAG reset
condition, which causes driver init failures when debugging the SoC
with JTAG. Fix by disabling all clocks for this reset type.
Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
Coverity reports a potential integer overflow in the accel_range
computation due to the use of a left shift on an int type.
CID 520269: Unintentional integer overflow (OVERFLOW_BEFORE_WIDEN)
Even though the register value is constrained to 0–3 by the BMA456 spec,
and no real overflow occurs, an explicit cast to int64_t prevents false
positives and aligns with safe coding practices.
Fixes: #90517
Signed-off-by: Gaetan Perrot <gaetan.perrot@spacecubics.com>
There was an unnecessary nested `if` in `ifx_cat1_counter_init` with the
same condition already checked in the outer block.
This results in dead and redundant code with no functional impact but
harms readability.
The inner `if (rslt != CY_RSLT_SUCCESS)` was removed to clean up the
function.
Signed-off-by: Gaetan Perrot <gaetan.perrot@spacecubics.com>
The function counter_rz_gtm_set_alarm was accessing alarm_cfg->flags and
alarm_cfg->ticks before verifying that alarm_cfg is non-NULL.
This could lead to undefined behavior or crashes if a NULL pointer is
passed.
The pointer check has been moved before any dereference to fix this bug.
Signed-off-by: Gaetan Perrot <gaetan.perrot@spacecubics.com>
In coap_well_known_core_get(), move the null check for 'resource' before
applying pointer arithmetic ('resource + 1') to avoid undefined behavior
when 'resource == NULL'.
Signed-off-by: Gaetan Perrot <gaetan.perrot@spacecubics.com>
Socket dispatcher (and offloaded implementations in tests) register
fd as ZVFS_MODE_IFSOCK therefore they should register a close2(
function instead of close().
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
socketpair fd regsiters ZVFS_MODE_IFSOCK therefore it should register a
close2() function instead of close().
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
In case address mode in a packet is none, the address pointer within mhr
struct will not be set. Therefore, the pointer should not be used before
address mode is verified inside ieee802154_check_dst_addr().
This was reported by UBSAN:
subsys/net/l2/ieee802154ieee802154.c:296:41: runtime error: member
access within null pointer of type 'struct ieee802154_address_field'
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
The iface test suite uses two different interface types with two
different context types and iid tests mixed up the two. It attempted
to create a mac address for Ethernet interface (which uses
struct eth_fake_context), however the net_iface_get_mac() function
only works with Dummy interface context (struct net_if_test). In
result the Ethernet interface context was corrupted (mac address
overwritten the promisc_mode flag).
Fix this by extracting mac generation code into a common function, and
use it in the Ethernet iface initialization phase instead of directly in
the test.
This was reported by UBSAN:
tests/net/iface/src/main.c:239:34: runtime error: load of value 11,
which is not a valid value for type '_Bool'
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Cast uint8_t variable to uint32_t explicitly to avoid implicit cast to
int, and thus potentially undefined behavior, reported by UBSAN:
net_pkt.c:1946:17: runtime error: left shift of 239 by 24 places
cannot be represented in type 'int'
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
In order to avoid alignment issues when casting void pointers to
in(6)_addr structures, create a properly aligned copy of the ip(v6)
address on stack.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
In order to prevent an overflow warning from UBSAN when bitshifting,
cast to uint64_t first before shifting, and then back to uint32_t.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
This was caught by UBSAN:
zvfs_select.c:70:2: runtime error: left shift of 1 by 31 places
cannot be represented in type 'int'
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
As struct sockaddr have now alignment of 4 bytes, net_ipaddr_copy()
gives the following error if used for sockaddr:
error: alignment 1 of ‘struct <anonymous>’ is less than 4
[-Werror=packed-not-aligned]
Just use memcpy() instead, net_ipaddr_copy() was intended to use with IP
addresses, not socket related structs.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
To avoid misalignment errors when casting between
sockaddr_storage/sockaddr and specialied sockaddr_* variants, specify
alignment for the former to match the alignment of the others.
The issue was reported by UBSAN:
utils.c:802:8: runtime error: member access within misaligned
address 0xf4aff186 for type 'struct sockaddr_in6', which requires
4 byte alignment
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Rework the IPv4-related code to avoid casting. Use raw variants of
IPv4-related functions whenever possible (especially on the critical
data path).
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
To address the misaligned access issues reported by UBSAN, introduce raw
variant of certain IPv4 functions used in the critical data path of the
network stack, operating on plain uint8_t buffers in stead of IPv4
address struct.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Rework the rest of the IPv6-related code to avoid casting. Use raw
variants of IPv6-related functions whenever possible (especially on the
critical data path). For the routing case, use a copy of the address to
avoid massive rework of the routing module.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
IPv6 Neighbor Discovery interfaces modules like neighbor or routing
tables - converting them to raw variants seems futile. Therefore, for
IPv6 ND case, copy the raw IP address from the packet into the in6_addr
structure, and then pass it to respective functions. Performance
overhead should not be a big problem in such case as those actions are
only performed if a respective ND packet is received.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Refactor local functions to work with byte buffers instead of struct
in6_addr and use switch to use raw variants of functions operating on
IPv6 addresses.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
To address the misaligned access issues reported by UBSAN, introduce raw
variant of certain IPv6 functions used in the critical data path of the
network stack, operating on plain uint8_t buffers in stead of IPv6
address struct.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
The peer uses the RPA address.
A BR connection is created firstly, a subsequent BLE connection is
created secondly, the BR SMP CTKD occur thirdly (The BLE LTK is
derived from BR and the BR SMP distribute peer's IRK and identity address
here), but the BLE LTK is saved to key pool that is not
matched with the previous BLE connection because the derived LTK is saved
with identity address and BLE connection uses RPA. Fix it by: Resolve the
BLE connections' RPA with the derived IRK to find the previous BLE
connections and match the connections with derived LTK key.
Signed-off-by: Mark Wang <yichang.wang@nxp.com>
Add a precision about the CONFIG_DEBUG :
When CONFIG_DEBUG is set, the system will not enter the low power mode
The DEBUG is possible but with higher power consumption of the target.
Signed-off-by: Francois Ramu <francois.ramu@st.com>
SENT, PSI5, Virtio where all recently added types. Add them to the
binding-types.txt file so that their full name can be displayed in the
documentation.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
This Kconfig was deprecated in Zephyr 3.5, remove allowing it to
be selected but keep the symbol as the HAL needs to be updated
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Fix a broken link in the 'contribute/proposals_and_rfcs.rst' file that
pointed to a non-existent Markdown RFC template.
The link previously pointed to:
.github/ISSUE_TEMPLATE/003_rfc-proposal.md
It has been corrected to point to the actual YAML file:
.github/ISSUE_TEMPLATE/003_rfc-proposal.yml
Fixes: #92342
Signed-off-by: Gaetan Perrot <gaetan.perrot@spacecubics.com>
LPTIM2 is enabled by default; disable it to avoid
the build failure:
"Error: Only one LPTIM instance should be enabled"
when LPTIM1 is also enabled in the DTS.
Signed-off-by: Fabrice DJIATSA <fabrice.djiatsa-ext@st.com>
define stm32_lp_tick_source since PM is looking for this node
and change clock source for lptim2 to lsi.
Signed-off-by: Fabrice DJIATSA <fabrice.djiatsa-ext@st.com>
According to RFC 793, ch 3.9 Event Processing,
after the connection is sync-ed with seqnum of both sides then,
1. drop any received segment if the ACK bit is off.
2. validate the acknum like this:
SND.UNA =< SEG.ACK =< SND.NXT
The ACK validation is done before entering the state-machine, so
remove the flags <ACK> check in the state-machine processing.
Signed-off-by: Shrek Wang <inet_eman@outlook.com>
The bus helpers for SETDASA and SETNEWDA could have the same
dynamic address assigned as it's static addr for SETDASA or
as it's dynamic addr for SETNEWDA. (Althrough, only a clown
would set the new dynamic address to the same old dynamic
address, it is still a valid address to set to).
Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
Drop LOG_ERR calls from driver level related to transfer calls.
Application can handle the result and decide whether to log or not.
Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
Build a combined mask from the tx_invert and rx_invert flags and pass it
to uart_hal_inverse_signal(). Only invoke the HAL call when the mask is
non-zero, preventing unintended inversions and eliminating redundant
calls when no inversion is requested.
Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
This adds the generic plugable alias to the Adafruit RP2040 QT PY for
its STEMMA-QT connector.
Signed-off-by: Ian Wakely <raveious.irw@gmail.com>
Signed-off-by: Ian Wakely <raveious.irw@gmail.com>
The LTDC RGB565 format corresponds to the PIXEL_FORMAT_BGR565 format.
Update the LTDC driver to advertise PIXEL_FORMAT_BGR565 as the supported
format instead of PIXEL_FORMAT_RGB565. This change ensures correct color
rendering in the sample display application and enables usage of the
video capture sample application.
Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>