Commit graph zephyr/subsys
Author SHA1 Message Date
Robert Lubos
3740a03136 net: ipv4: igmp: Make use of mcast address ref counting
Don't send IGMP report on join if the address was already joined,
only increase the ref count by calling net_if_ipv6_maddr_add().

On leave, only send report if the address was removed from the system
(i.e. is no longer in use).

For IGMPv3 specifically, if the address with non-empty include/exclude
list was already registered, return an error as registering lists from
different sources is currently not supported.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2026-03-04 16:43:42 +00:00
Robert Lubos
e1854efd3b net: iface: Add multicast address ref counting
Add ref counting for multicast addresses, so that if a multicast address
is registered from different subsystems, they won't interfere with each
other. That way, if one subsystem decides to remove a multicast address,
it won't affect other subsystems that may still need it.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2026-03-04 16:43:42 +00:00
Emil Gydesen
f5f9a0e0f3 Bluetooth: CCP: Modify get_bearer_provider_name to use output buffer
Modify bt_ccp_call_control_server_get_bearer_provider_name to
store the bearer provider name in an output buffer, instead of just
providing the pointer.

The reason for this is to make the result thread safe, and
avoid the user/application having a direct pointer to
internal storage.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-03-04 14:34:10 +00:00
Emil Gydesen
d0dae06458 Bluetooth: Host: Make ACL/CIS disconnect order deterministic
Currently the other of the ACL and CIS disconnect callbacks
depend on the order of the HCI events received. Since this
order is not specified by the core spec, it means that any
users/applications of ISO will need to wait for all CIS
disconnects callbacks and the ACL disconnect callback before
attempting to reuse any of them.

From an API perspective this is not ideal, and the API will
be much simpler if the order of ACL and ISO disconnect
callbacks were deterministic, regardless of the controller.

This change postpones the finalization of the ACL disconnect
until all the CIS associated with it has been disconnected.
This will also make the API more similar to e.g. the L2CAP
disconnect order.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-03-04 14:30:00 +00:00
Emil Gydesen
0c354b1573 Bluetooth: CAP: Handover: Add broadcast_created callback
Add a new callback for when the broadcast source has been
created. This callback is useful for the application to
configure the periodic advertising with the BASE of the
broadcast source. Configuring and starting the
periodic advertising with the BASE at that point in time
may optimize how quickly the procedure can be completed.

A callback was chosen, rather than having the stack set
up the data itself, because that the application may
want to add additional data in the periodic advertising,
and thus the owner of the data should be the application,
and not the stack.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-03-04 13:35:48 +01:00
Zhaoxiang Jin
2e9f09e12d pm: policy: change 'greater than or equal' to 'greater than'
The comment definition for pm_policy_latency_request_add
states: states that exceed the given latency are unavailable.
However, the implementation in pm_policy_latency_update_locked
does not use the greater-than operator, so according to the
semantics, it should be changed to > to be consistent.

Signed-off-by: Zhaoxiang Jin <Zhaoxiang.Jin_1@nxp.com>
2026-03-04 11:42:11 +01:00
Lyle Zhu
d3e7a8300a bluetooth: classic: obex: fix abort response handling for last client
Fix OBEX abort response handling when no active client exists by
tracking the last executing client and its previous opcode.

- Add _last_client pointer to track the most recent executing client
- Add _pre_opcode to store the opcode before clearing _opcode
- Save client state before clearing opcode in all operation handlers
- Implement obex_get_last_client() to recover client context for abort
- Handle abort responses even when _active_client is already cleared
- Clear last client tracking on transport connect/disconnect

This ensures abort responses are properly delivered to the correct
client callback even if the operation has already completed.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2026-03-03 19:13:18 +00:00
Martin Stumpf
2ef7ee567e mcumgr: Fix 'stat' group error codes
Error codes of group 'stat' were incorrectly labeled as group 'zbasic'.

Signed-off-by: Martin Stumpf <finomnis@gmail.com>
2026-03-03 18:00:54 +01:00
Lyle Zhu
9db318da9a Bluetooth: Classic: SDP: Add zero-length data element check
Add validation to detect and handle zero-length data elements during
SDP attribute parsing. When the parsed data element length is zero,
log a debug message and return early to avoid unnecessary processing.

This check is placed after parsing the data element length but before
the nesting level validation, ensuring that:
- Empty data elements are gracefully handled without errors
- The parser doesn't attempt to process or skip zero bytes of data
- Subsequent attribute parsing continues normally

This prevents potential issues when SDP records contain empty data
elements and improves parser robustness when handling malformed or
edge-case SDP attribute structures.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2026-03-03 17:57:11 +01:00
Lyle Zhu
85bbfef282 Bluetooth: Classic: SDP: Fix nesting level check timing
Move the nesting level check to occur after parsing the data element
length instead of before. This ensures that when the maximum nesting
level is exceeded, the parser can properly skip the nested data by
pulling the correct length from the buffer.

Previously, checking the nesting level before parsing the length meant
the parser would return early without consuming the nested data,
potentially causing parsing errors for subsequent attributes.

The updated logic:
- Parses the data element type and length first
- Checks if maximum nesting level is exceeded
- If exceeded, logs a warning and skips the data element entirely
- Otherwise, proceeds with recursive parsing as normal

This prevents buffer misalignment when deeply nested sequences are
encountered in SDP attribute records.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2026-03-03 17:57:11 +01:00
Lyle Zhu
f9e21462e2 Bluetooth: Classic: SDP: Fix parsing of nested sequences
Fix SDP attribute parsing to properly handle nested sequences within
attribute values. Previously, when an attribute value itself contained
a sequence, the parser would not recursively parse the nested sequence,
potentially missing nested attribute data.

Add recursive parsing logic that:
- Detects if the current value buffer contains a sequence type
- Recursively calls sdp_attr_parse() with incremented nest level
- Properly handles nested sequence structures in SDP records

This ensures complete parsing of complex SDP attribute structures that
contain sequences within sequences, such as protocol descriptor lists
or service class ID lists with nested elements.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2026-03-03 17:57:11 +01:00
Lyle Zhu
7f8064f5bc bluetooth: classic: GOEP: refactor RFCOMM initialization
Extract common GOEP RFCOMM initialization logic into a separate function
to eliminate code duplication between accept and connect paths.

- Add new goep_rfcomm_init() function containing shared initialization:
  * MTU calculation and validation
  * Transport operations registration
  * RFCOMM DLC configuration
  * GOEP state setup
- Update goep_rfcomm_accept() to use the new init function
- Update bt_goep_transport_rfcomm_connect() to use the new init function

This refactoring reduces code duplication and ensures consistent
initialization behavior for both server (accept) and client (connect)
code paths.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2026-03-03 13:27:25 +01:00
Lyle Zhu
5103438833 bluetooth: classic: GOEP: refactor L2CAP initialization
Extract common GOEP L2CAP initialization logic into a separate function
to eliminate code duplication between accept and connect paths.

- Add new goep_l2cap_init() function containing shared initialization:
  * MTU calculation and validation
  * Transport operations registration
  * L2CAP channel configuration
  * GOEP state setup
- Update goep_l2cap_accept() to use the new init function
- Update bt_goep_transport_l2cap_connect() to use the new init function

This refactoring reduces code duplication and ensures consistent
initialization behavior for both server (accept) and client (connect)
code paths.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2026-03-03 13:27:25 +01:00
Alex Ciascai
e575733f4d bluetooth: tbs: fix Dialing -> Alerting transition handling for PTS VRC
This change ensure that TBS bearers promote dialing -> alerting
independently of GTBS. GTBS no longer blocks the state transitions,
promotion only waits for the bearer's own pending notifications to
clear, preserving notification ordering. GTBS continues to aggregate
the updated state correctly

Signed-off-by: Alex Ciascai <alexandru.ciascai@nordicsemi.no>
2026-03-03 11:17:18 +01:00
Emil Gydesen
f04042714d Bluetooth: BAP: Unicast Client: Handle unexpected ASE IDs
If we receive a control point notification with an ASE ID that
does not match any existing streams, i.e. audio_stream_by_ep_id
returns NULL, we should not continue by calling the subsequent
functions like unicast_client_notify_ep_config with a NULL stream.

A single notification may contain multiple ASE IDs; if any of them
are unknown, we can either reject the entire notification, or
we can ignore the specific ASE ID. For now, ignore the
specific ASE ID to do a best effort to continue with
any other changes.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-03-03 11:15:45 +01:00
Emil Gydesen
6eb77788af Bluetooth: MCS: Dont discard notifications on read
Remove calls to atomic_clear_bit on reads. Even if a characterstic
is read while there is a pending notification, we shall
(as per the MCS spec) still send the notification.

There are 3 special cases for long (string) values, where we
need to know the difference between a changed value (pending
for notification), and a value that has changed since last
read. To support this, these 3 cases now have _DIRTY flags
to indicate that the values are dirty and must be read from
the beginning again.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-03-03 11:11:03 +01:00
Pisit Sawangvonganan
a8791c8c4d settings: make NVS and ZMS store interface instances const
Mark `settings_nvs_itf` and `settings_zms_itf` as `const` since
they are statically defined interface tables that are never
modified at runtime.

This lets the compiler place them in read-only storage and
trims RAM usage.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2026-03-02 15:58:35 -08:00
Adam Wojasinski
5b32348c1b net: ptp: Fix undefined bitwise shift in port management
Add bounds checking to PTP management interval parameters to prevent
undefined behavior from bitwise shift operations.

The port_timer_set_timeout() and port_timer_set_timeout_random()
functions perform left and right shift operations using the
log_announce_interval and log_sync_interval values as shift counts.
Without bounds validation, these int8_t parameters could be set to
extreme values (e.g., via PTP management messages) that exceed the
valid shift range, causing undefined behavior.

(C11, 6.5.7p3)
> If the value of the right operand is negative or is greater than
or equal to the width of the promoted left operand,
the behavior is undefined

(C++11, 5.8p1)
> The behavior is undefined if the right operand is negative,
or greater than or equal to the length in bits of the promoted
left operand.

Limit both log_announce_interval and log_sync_interval to the range
[-63, 63] using MIN/MAX macros when accepting values from PTP management
frames. This range is preventing shift operations outside
the 64-bit width used in the timeout calculations.

Fixes: GHSA-3v98-458v-388r

Signed-off-by: Adam Wojasinski <awojasinski@baylibre.com>
2026-03-02 15:57:04 -08:00
Vinayak Kariappa Chettimada
53d053359a Bluetooth: Controller: nRF54Lx: Fix DTM when using GRTC
Fix nRF54Lx DTM implementation when using GRTC. The Radio
start needs to be offset by a maximum ISR latency value that
is less than inter-frame switching, plus minimum counter
compare offset that can be set, plus minimum CPU latency to
set the counter compare register.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2026-03-02 15:44:30 -08:00
Vinayak Kariappa Chettimada
8f77fc6e08 Bluetooth: Controller: nRF5x: Tune counter compare minimum and latency
Tune counter compare minimum and latency.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2026-03-02 15:44:30 -08:00
Vinayak Kariappa Chettimada
5e2e989cdc Bluetooth: Controller: Use clock startup time from devicetree
Use clock startup time from devicetree.

Relates to commit 72dac165d8 ("Bluetooth: Controller: Use
OVERHEAD_XTAL_US from devicetree").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2026-03-02 15:44:30 -08:00
Zhaoxiang Jin
9834dac28a pm: policy: add NULL callback support for latency subscriptions
The comment for the API pm_policy_latency_changed_subscribe
states: "NULL to disable", but the function implementation
directly saves and subscribes to this node, and subsequently
calls it directly without null checking when changes occur.
This actually poses a risk of calling a null function pointer.

This commit fixes this issue to make the function implementation
consistent with the API description.

Signed-off-by: Zhaoxiang Jin <Zhaoxiang.Jin_1@nxp.com>
2026-03-02 11:01:47 +01:00
Zhaoxiang Jin
2865d5ce0d pm: policy: replace DT_PROP_LEN with ARRAY_SIZE
Use ARRAY_SIZE macro to determine the size of the pm_constraints
array instead of DT_PROP_LEN. Because a practical issue is that
'zephyr, disabling-power-states' may contain multiple power states,
but one of the power states is in a disabled status. In this case,
the size obtained by DT_PROP_LEN is larger than the actual size.

Signed-off-by: Zhaoxiang Jin <Zhaoxiang.Jin_1@nxp.com>
2026-03-02 10:58:56 +01:00
Zhaoxiang Jin
af746bc840 pm: policy: Improve the event implementation
1. Updated event-related API docs to fix wording and clarify
semantics ("earliest/soonest event", ticks vs cycles).

2. Improve the event implementation to prevent list corruption on misuse:
- pm_policy_event_register() is now idempotent: re-registering
  the same evt updates its time instead of appending a duplicate node.
- pm_policy_event_update() / pm_policy_event_unregister() become clean
  no-ops if evt is not currently registered.
- Kept a basic evt != NULL assertion.

Signed-off-by: Zhaoxiang Jin <Zhaoxiang.Jin_1@nxp.com>
2026-03-02 10:58:14 +01:00
Thomas Hebb
86b9ebadc6 bluetooth: classic: did: Set up logging
This file fails to compile since commit ef7b132bfd ("Bluetooth:
Classic: Fix initialization to support re-initialization"), which added
a LOG_ERR() invocation but didn't setup logging for the file.

Fixes #101810

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>
2026-03-02 10:49:56 +01:00
Robert Lubos
5ab02c7e7a net: ip: Allow to specify default router with net_if_ipv6_router_add()
Align the net_if_ipv6_router_add() behavior with its IPv4 counterpart,
where it is possible to specify whether the router is a default one
instead of making assumptions based on the lifetime value.

The current behavior was likely inspired by the Neighbor Discovery RFC,
where the lifetime parameter of 0 received in the Router Advertisement
message indicates that the router should not be treated as a default
router, however this is an implementation detail of the Neighbor
Discovery protocol and does not need to be enforced at the router API
level, as this can be used outside of this protocol (for example when
router is added manually from the application).

Therefore, allow to specify the "is_default" parameter separately just
like in the IPv4 case.The Router Advertisement handling routine will
just specify the "is_default" value based on the received lifetime
value.

Also, clarify in the function documentation what does it mean to specify
lifetime to 0 (which means the router never expires according to current
implementation).

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2026-02-27 21:03:52 +00:00
Henrik Brix Andersen
b439029296 net: lib: sockets: can: always verify length in zcan_sendto_ctx()
Always verify the length in zcan_sendto_ctx().

Fixes: #104652

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2026-02-27 15:31:55 +01:00
Tim Pambor
4d6de96ad4 net: ipv4: avoid casting unaligned address to net_in_addr
This change addresses an alignment problem reported by UBSAN by
using a copy of the address. This avoids the need for extensive
rework to support net_if_ipv4_maddr_lookup_raw variant.

Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
2026-02-27 15:31:26 +01:00
Alberto Escolar Piedras
61e6c0b2a1 mgmt: updatehub: Use renamed network APIs
In
d45cd6716b
f27a26f9ec
the mayority of this code was changed to use the new native networking
API naming, but one macro was forgotten.

Let's change it now so this code builds also without
CONFIG_NET_NAMESPACE_COMPAT_MODE

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2026-02-27 13:56:24 +01:00
Alberto Escolar Piedras
eed8d23140 net: shell: pmtu: Fix net API use
In d45cd6716b the mayority of the
Zephyr codebased was changed to use the Zephyr native net_ prefixed
types, but some were forgotten.
Without this fix/change the code still builds as we are by now setting
CONFIG_NET_NAMESPACE_COMPAT_MODE. But when this is not set, things
fail to build.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2026-02-27 13:56:24 +01:00
Alberto Escolar Piedras
4e04b519d1 net: sockets: tls: Fix net API use
In d45cd6716b the mayority of this code
was changed to use the Zephyr native net_/zsock_ prefixed types/functions
but some were forgotten.
Let's fix it.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2026-02-27 13:56:24 +01:00
Alberto Escolar Piedras
6ef9e8f2d2 net: lwm2m: Use ZTESTABLE_STATIC instead of STATIC
Use the ZTESTABLE_STATIC macro to define symbols which need to be
accessible from ztests, instead of redefining STATIC which causes
trouble with some hals.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2026-02-27 11:50:41 +01:00
Alberto Escolar Piedras
ef2773dffe fs: nvs: Use ZTESTABLE_STATIC instead of STATIC
Use the ZTESTABLE_STATIC macro to define symbols which need to be
accessible from ztests, instead of redefining STATIC which causes
trouble with some hals.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2026-02-27 11:50:41 +01:00
Alberto Escolar Piedras
c77d74fa7d Bluetooth: Classic: Shell: Use ZTESTABLE_STATIC instead of STATIC
Use the ZTESTABLE_STATIC macro to define symbols which need to be
accessible from ztests, instead of redefining STATIC which causes
trouble with some hals.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2026-02-27 11:50:41 +01:00
Jordan Yates
7344fa4db9 debug: thread_analyzer: ISR info to callback
Run the user provided callback for the ISR stacks, instead of ignoring
the callback and printing the summary.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2026-02-27 07:57:33 +01:00
Alberto Escolar Piedras
8c06719191 net: lwm2m: Remove use of fcntl.h macros from messages
Just for consistency with the code and to avoid finding them on searches,
use the actually used macro names in the log messages.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2026-02-26 21:25:31 +00:00
Emil Gydesen
49bb9e2034 Bluetooth: ISO: Fix bad sys_get for {c,p}_latency
The fields in the HCI events are 24-bits but were treated
as 16-bit values.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-26 21:24:34 +00:00
Aleksandr Mirlenko
c26eda3b71 bluetooth: host: add support for CS IPT procedures
Add support for CS IPT (Channel Sounding Inline PCT Transfer)
in the Bluetooth host stack.

Changes include:
* definition of new CS IPT HCI opcodes;
* handling of CS IPT control procedures;
* integration with existing CS infrastructure;
* necessary updates to public headers.

Signed-off-by: Aleksandr Mirlenko <aleksandr.mirlenko@nordicsemi.no>
2026-02-26 16:53:17 +00:00
Valerio Setti
e8cb9ba0d7 net: lib: http_server: remove legacy Mbed TLS header inclusion
This was a leftover from the previous commit that removed usage of
legacy crypto in favor of PSA API.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2026-02-26 08:48:27 -06:00
Kyra Lengfeld
354e3cb040 Bluetooth Host: Fix memory leak in ATT prep_pool
Before this we have a memory leak in the prep_pool when reassembly fails
in :c:func:`att_exec_write_rsp`. Now on error the buffer is dequeued and
freed, as are remaining queued prepare buffers.

Signed-off-by: Kyra Lengfeld <kyra.lengfeld@nordicsemi.no>
2026-02-26 12:36:03 +01:00
Shay Gi
fa321c1c2d Bluetooth: Fix typo of supervision
Fixed typos in code of "supervison" to supervision.

Signed-off-by: Shay Gi <s02998491@gmail.com>
2026-02-26 12:32:14 +01:00
Pete Johanson
dbe1e63d36 ipc: Move to barrier_sync_synchronize()
Move the IPC subsystem to the new barrier_sync_synchronize()
wrapper API.

Signed-off-by: Pete Johanson <pete.johanson@analog.com>
2026-02-25 18:47:53 +01:00
Julien Vermillard
0a64b9aae3 net: lwm2m: send scheduler: gate path formatting to DBG logs
The send scheduler formatted LwM2M paths with `lwm2m_path_log_buf()` even
when debug logging was not enabled for the module, causing build issues
with CONFIG_LOG off.

Signed-off-by: Julien Vermillard <julien@clunkymachines.com>
2026-02-25 13:23:07 +01:00
Andreas Anderberg
aa9fd2ea73 fs: zms: Add zms_mount_force()
zms_mount_force() behaves like zms_mount() but automatically wipes and
reinitializes the partition if the initial mount attempt fails.

A corresponding Kconfig option SETTINGS_ZMS_FORCE_MOUNT is added to the
settings subsystem to enable this behavior when using ZMS as the
settings backend.

Signed-off-by: Andreas Anderberg <andreas.anderberg@u-blox.com>
2026-02-25 13:04:53 +01:00
Johann Fischer
7158c64690 include: drivers: usb: rename UDC buffer to USB buffer
Rename it to USB buffers so we can use it in host support without
confusion. Keep the UDC_* macros for now, we can deprecate and remove
them later.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2026-02-24 16:01:21 -06:00
Robert Lubos
caa6273301 net: shell: Add FTP module
Add FTP shell module covering basic FTP client operations.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2026-02-24 15:37:25 +01:00
Robert Lubos
991ea36f70 net: lib: ftp_client: Add FTP client library
Add FTP client library, based on the FTP client library from nRF Connect
SDK.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2026-02-24 15:37:25 +01:00
Emil Gydesen
dd72c4c711 Bluetooth: BAP: SD: Fix issues with pa sync requests
The implementation only used the receive state's PA sync state
to determine whether to call the PA sync req or PA sync term req,
but that state does not include the syncing state.

Rather than using the receive state's PA sync state, we add a local
boolean to keep track of whether the PA sync was requested, so if
we receive a mod_src with PA sync == BT_BAP_BASS_PA_REQ_NO_SYNC then
we request a termination, even if the PA sync was not established yet.

Some cleanup in the mutex handling was also done as part of this.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-24 15:35:54 +01:00
Jukka Rissanen
0747bca9e1 net: ipv4: Do packet length checks before starting fragment reassembly
Make sure to check packet length check before starting the
IPv4 fragmentation reassembly process. This way we can drop the
malformed packet without consuming resources.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-02-24 13:53:25 +01:00
Lingao Meng
f9d4e653d1 nvs: fix delete ATE length inconsistency during GC
Delete entries in NVS are represented by an ATE with len == 0 and
no associated data.

However, when GC is triggered by a delete operation, the
propagated ATE length may become non-zero due to unconditional CRC
addition, leading to inconsistent semantics and potential mount or
space calculation issues.

Introduce nvs_data_len_with_crc() to centralize the logic of
conditionally adding the data CRC size. This ensures that delete
entries always retain len == 0 and restores consistency across write,
GC and space calculation paths.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2026-02-24 10:41:31 +01:00